Jump to content

dropdown list problem


gudfry

Recommended Posts

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

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>';
   ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.