<?php $PageSecurity = 11;
include('includes/session.inc');
include('includes/header.inc');
include('includes/SQL_CommonFunctions.inc');
 
if(isset($_GET['country'])) {
$country = $_GET['country'];
//echo $country;
?>
      <div id="searchstate"><select name="state" id="state" onchange="search_city(this.value)">
       <option value="000">---Select State---</option>
	   <?php 
	    $sql = "select * from state_master where country = '".$country."' ";
		$result=DB_query($sql,$db);
		while($myrow=DB_fetch_array($result))
		{ 
			$p='';
			if($myrow['id'] == $_POST['state'])
			$p="selected";
		?>
		<option value="<?php echo $myrow['id'];?>"<?php echo $p;?>><?php echo $myrow['state']; ?></option>
		<?php }
	   ?>
      </select></div>
<?php } else if(isset($_GET['site_country'])) {
		$site_country = $_GET['site_country'];
		//echo $site_country;
		?>
		
		<div id="searchstate">
 <select name="State" id="State" onchange="search_city(this.value)">
       <option value="">---Select State---</option>
	   <?php 
	    $sql = "select * from state_master where country = '".$site_country."' ";
		$result=DB_query($sql,$db);
		while($myrow=DB_fetch_array($result))
		{ 
			$p='';
			if($myrow['id'] == $row['pre_state'])
			$p="selected";
		?>
		<option value="<?php echo $myrow['id'];?>" <?php echo ($row['pre_state']==$myrow['id']?"selected":"") ?>><?php echo $myrow['state']; ?></option>
		<?php }
	   ?>
      </select>
 </div>
 <?php } ?>