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.

 

 

Link to comment
Share on other sites

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']

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.