Jump to content

select box attributes


amalafrida

Recommended Posts

I have 5 items in the select/combo box

 

when I _POST that item, I am returned the text contained in the box.

 

BUT, can I know WHICH of the 5 items in the combo box it is?

 

i.e. can I get its index number?

 

.............

ok, yes. thanks. I feared I was skirting that treacherous line betwixt the 2.

 

thanks for the help. you folks are invariably straight up, spot on, not to mention accurate.

 

 

You can get whatever you assign as the "value" attribute of the OPTION selected.

 

<SELECT name="cmbChoose">
  <OPTION>Me</OPTION>
  <OPTION>Her</OPTION>
</SELECT>

 

Using this example, you will get either "Me" or "Her" from $_POST['cmbChoose']

 

<SELECT name="cmbChoose">
  <OPTION value="1">Me</OPTION>
  <OPTION value="2">Her</OPTION>
</SELECT>

 

Using this example, you will get either "1" or "2" from $_POST['cmbChoose']

 

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.