Jump to content

get text value from dropdown list


juggysingh
 Share

Recommended Posts

Hi, :)Is there anyway to retrieve the selected text value aswell as the value from a drop down list?

<select name="dropdwn1" id="dropdwn1" size="1">  <option value="0" selected="selected">Choose</option>  <option value="value1">text1</option>  <option value="value2">text2</option></select>

Link to comment
Share on other sites

Is there anyway to retrieve the selected text value aswell as the value from a drop down list?
Depends on how you want to retrieve it. If you want to get it in PHP you need to do as jsg said and include the text in the value of the option, then break it apart in PHP. However, you can access the selected options text using JavaScript.http://w3schools.com/jsref/dom_obj_select.asp
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...