populating the drop down list based on the selected value of first list
<p>i have 2 list box the first one for the country , the other for the city
when the user choose one country it should populate the city based on the country </p>

<p>the database for county is( CountryID (pk), Code (pk), Name) 
city(CountryCode(pk),Name)</p>

<p>i create java script   function  called reload that load the page onChange
its working good but the problem in the city list it is not populated with the country item ..it is still empty..
here is my code . i just post the code that relate to the problem , its too long page.
this code for page </p>

<p>dd-check.php</p>

<pre><code>&lt;?php
$cat = $_GET['Country'];
$subcat = $_POST['City'];
?&gt;
</code></pre>

<p>CreateAccount.php</p>

<pre><code>&lt;script language=JavaScript&gt;
function reload(form)
{
  var val = form.Country.options[form.Country.options.selectedIndex].value; 
  self.location = 'Create_Account.php?country=' + val ;
}
&lt;/script&gt;

&lt;form id="form2" method="post"  enctype="multipart/form-data" action="dd-check.php"&gt;
&lt;?php
$Con= mysql_connect("localhost","root",""); 

if(!$Con) 
{ 
  die('Could not connect'.mysql_error());
}

if(!mysql_selectdb("rlounge",$Con))
{
  die(mysql_error());
}

@$cat = $_GET['Country'];

if(strlen($cat) &gt; 0 and !is_numeric($cat))
{  
  echo "Data Error";
  exit;
}

$quer2 = "SELECT *  FROM country";
$result = mysql_query($quer2);
if(isset($cat) and strlen($cat) &gt; 0)
{
  $quer = mysql_query(" SELECT city.`Name` ,  `CountryCode` 
                        FROM  `city` ,  `country` 
                        WHERE  `CountryCode` =  $cat
                        AND  `Code` =  `CountryCode` "); 
}
else
{
  $quer = mysql_query(" SELECT City.name
                      FROM  `city` ,  `country` 
                      WHERE  `Code` =  `CountryCode`"); 
} 
//$cat=$_GET['Country'];
//$subcat=$_POST['City'];
echo "&lt;select name='Country' onchange=\"reload(this.form)\"&gt;&lt;option value=''&gt;Select     one&lt;/option&gt;";
while($noticia2 = mysql_fetch_array($result)) 
{ 
  if($noticia2['Code'] == $cat)
  {
    echo "&lt;option selected value='$noticia2[Code]'&gt;$noticia2[Name]&lt;/option&gt;"."&lt;BR&gt;";
  }
  else
  {
    echo "&lt;option value='$noticia2[Code]'&gt;$noticia2[Name]&lt;/option&gt;";
  }
}
echo "&lt;/select&gt;";
echo "&lt;select name='City'&gt;&lt;option value=''&gt;Select one&lt;/option&gt;";
while($noticia = mysql_fetch_array($quer)) 
{ 
  echo  "&lt;option value='$noticia[CountryCode]'&gt;$noticia[Name]&lt;/option&gt;";
}
echo "&lt;/select&gt;"; 
?&gt;
&lt;/form&gt;
</code></pre>
