Jump to content

dependent dropdown shows numeric value in db instead of label


jmcc

Recommended Posts

Hi

 

I have 3 dependent dropdown menus. When I insert their value into my db the values are numeric not the label. I would appreciate any help.

 

my table has 2 fields id_prov and name_prof.

 

drop down code:

 

        <php>

do { 

?>

        <option value="<php echo $row_province['id_prov']?>"><php echo $row_province['name_prov']?></option>

        <php

} while ($row_province = mysql_fetch_assoc($province));

  $rows = mysql_num_rows($province);

  if($rows > 0) {

      mysql_data_seek($province, 0);

  $row_province = mysql_fetch_assoc($province);

  }

?>

      </select>

       

Your select is giving the value of id but display the name..

 

I'm assuming you want the form value to be the name as well as displaying the name in the drop down?

 

change this:

 

<option value="<php echo $row_province['id_prov']?>"><php echo $row_province['name_prov']?></option>

 

to this:

 

<option value="<php echo $row_province['name_prov']?>"><php echo $row_province['name_prov']?></option>

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.