gudfry Posted August 6, 2008 Share Posted August 6, 2008 hi all; I have code that proform the dropdown list of the country. then after submmitted, it show the ouput, but the country i select from my drop down list, did not display. here is my whole code of drop down list. echo '<input name="country" type="hidden" id="country" size="30" maxlength="75">'; echo'<select name="country">'; $res=mysql_query("select * from county_hotels"); if(mysql_num_rows($res)==0) { echo "there is no data in table.."; } else { for($i=0;$i<mysql_num_rows($res);$i++) { $row=mysql_fetch_assoc($res); echo "<option value=".$row['id'].">$row[country]</option>"; } } echo'</select>'; ?> here is the ouput, after submitted. the country does not display Country : Name : xxxxx email : xxxxx phone : xxxxx Services : xxxxx Other Requirements : xxxxxx Any idea? Link to comment https://forums.phpfreaks.com/topic/118409-dropdown-list-problem/ Share on other sites More sharing options...
JasonLewis Posted August 6, 2008 Share Posted August 6, 2008 Why do you have two fields called country? Link to comment https://forums.phpfreaks.com/topic/118409-dropdown-list-problem/#findComment-609428 Share on other sites More sharing options...
MasterACE14 Posted August 6, 2008 Share Posted August 6, 2008 try: <?php echo '<input name="country" type="hidden" id="country" size="30" maxlength="75">'; echo'<select name="country">'; $res=mysql_query("select * from county_hotels") or die("Query Failed: ".mysql_error()); if(mysql_num_rows($res)==0) { echo "there is no data in table.."; } else { $row=mysql_fetch_assoc($res); echo "<option value=".$row['id'].">" . $row['country'] . "</option>"; } echo'</select>'; ?> Link to comment https://forums.phpfreaks.com/topic/118409-dropdown-list-problem/#findComment-609438 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.