Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select option to variable

Status
Not open for further replies.

playerx

Technical User
Joined
Feb 23, 2006
Messages
10
Location
US
How can I set a variable to the selection that I give and then pass that variable to another page once the button is clicked from the form?

thanks in advance


<select name="priority" id="priority">
<option></option>
<option>Critical</option>
<option>Asap</option>
<option>This Day</option>
<option>This Week</option>
<option>This Month</option>
<option>Take Your Time</option>
</select>
 
You need to give your options values. The browser does everything else for you:

Code:
<option [!]value="1"[/!]>Critical</option>
<option [!]value="2"[/!]>Asap</option>

They don't necessarily have to be numerical values, either:

Code:
<option [!]value="cru"[/!]>Critical</option>
<option [!]value="asa"[/!]>Asap</option>

You just need to pick up on the form submission server-side (or client-side if you really must, but use the get method for this).

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top