Click to See Complete Forum and Search --> : Set the value of drop down box from another page


Foundas
02-22-2009, 07:52 AM
Hi all,


in my contact page, im using a drop down box with 6 entries. Is there a way to pre-set the entry of the drop down box through a link on another page automatically?

For instance...in about page, i have a link that takes you to the contact page to submit a request (thus here, to set which entry to select). Is it possible when contact page loads, the drop down box to show automatically the pre-selected entry??

Any help in vbscript/asp would be greatly appreciated

Many thanks

Foundas

nbcrockett
02-24-2009, 11:14 PM
Your link would look like this:
www.domain.com/contacts.asp?FromOtherPage=One

Your code would look like this:

<%
Select Case Request.QueryString("FromOtherPage")
Case "One"
strOne = "selected"
Case "Two"
strTwo = "selected"
Case "Three"
strThree = "selected"
Case "Four"
strFour = "selected"
Case "Five"
strFive = "selected"
Case "Six"
strSix = "selected"
End Select
%>

<select name="drpFromOtherPage" id="drpFromOtherPage" size="1" tabindex="8">
<option selected value="NA"></option>
<option <% Response.Write strOne %> value="One">One</option>
<option <% Response.Write strTwo %> value="Two">Two</option>
<option <% Response.Write strThree %> value="Three">Three</option>
<option <% Response.Write strFour %> value="Four">Four</option>
<option <% Response.Write strFive %> value="Five">Five</option>
<option <% Response.Write strSix %> value="Six">Six</option>
</select>

Foundas
02-25-2009, 04:11 PM
Hi nbcrockett

many thanks for the code mate. It works like a charm


All the best

Foundas