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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select box value?

Status
Not open for further replies.

riarc

Programmer
Dec 6, 2001
44
US
I know this is a dumb question but this the first time I have tried to create a web page. How do I get the value of a select box.
I have this tag <SELECT name=&quot;loc&quot;> that I am inserting loctions from my db. When the user selects a location I want to call my next asp page. (report.asp) I also have to make sure that the value does not = &quot;Select a Location&quot;
Does anybody know how to do this?
 
Example select in a form
...
<form name=&quot;frmSubmit&quot; action=&quot;report.asp&quot; method=&quot;post&quot;>
<select name=&quot;loc&quot; onchange=&quot;SubmitForm(this)&quot;>
<option value=&quot;default&quot;>Select a Location</option>
<option value=&quot;database value(usually id)&quot;>Database value (description)</option>
</select>
...
</form>
Add the following javascript:
<script language=javascript>
function SubmitForm(theField)
{
if(theField.value!=&quot;default&quot;)
{
frmSubmit.submit;


}

}
</script>


on Report.asp

<%
sSelectValue=request.form(&quot;loc&quot;)
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top