php - displaying info in select input from database -


is there way display $city database select input ? using loop or ? find trials below: thank in advance

php code

<?php  //get city value if($city == 'choose city') {     $city = $row['city']; }    ?> 

html code

<select name="city">         <option value="0" selected>choose city</option>     <option value="1">milan</option>     <option value="2">paris</option>     ... </select> 

here use $mydata variable being connection code can add if need it. tis code loop round cities many times there cities.

    while($record = mysql_fetch_array($mydata)){         echo  $record['city'] ;         echo  "<br>";     } 

i hope helps! ask if need other help!


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -