<?php  
include('../common/connect.php');




$state=$_POST['state'];
$sql=mysql_query("SELECT * FROM `city` WHERE `state_id` = '$state' ORDER BY `city`.`cityname` ASC") or die(mysql_error());
echo "<option value=''>SELECT CITY</option>";
while($var=mysql_fetch_array($sql))
{
echo "<option value=$var[city_id]>$var[cityname]</option>";
 }
 
if(isset($_POST['subject']) && !empty($_POST['subject']))
{ 
   $subject=$_POST['subject'];
$sql1=mysql_query("SELECT * FROM `distance_subject` WHERE `semester_id` ='$subject'") or die(mysql_error());
while($var1=mysql_fetch_array($sql1))
{
echo "<option value=$var1[subject_id]>$var1[subject_code] - $var1[subject_name]</option>";
 }
}
?>