display data from databse after selecting any valur from dropdwonlist in php
<p>I want to retrive data(i.e.City) from database &amp; manipulate in drodownlist after that if select any city from drodownlist then diplay information related to that city from database in PHP.</p>

<p>here is my code for review</p>

<pre><code> &lt;?php
$con=mysql_connect("localhost","root","");
mysql_select_db("task",$con);
$sql="Select distinct city from collegetb";
$result=mysql_query($sql,$con);
?&gt;
&lt;select name="city" id="city" onchange="javascript:selectChanged();"&gt;
&lt;option cname=0&gt;------select city------&lt;/option&gt;
&lt;?php
$i=1;
while($row=mysql_fetch_row($result))
{
?&gt;
&lt;option cname="&lt;?php echo $i?&gt;"&gt;
&lt;?php
echo $row['0'];
?&gt;
&lt;/option&gt;
&lt;?php
$i=$i+1;
}
?&gt;
&lt;/select&gt;
&lt;html&gt;
&lt;head&gt;

&lt;title&gt;MBA Colleges&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form method=post action="mbac.php"&gt;
&lt;input type=submit name='b1' value="Search"&gt;&lt;/input&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
