jeremyll
asked on
ASP classic: best way to do drop down list using <form>
ASP classic: What is the best way to do drop down list using <form>
I would like to store this info into a session variable or cookie. This info is input entered by the user who fills out a form.
Is below any help?
<html><body><form>
<h2>HelloWorld<h2>
<h3>What's your favorite colour?</h3>
<select name='colour'>
<option> red</option>
<option> white</option>
<option> blue</option>
</select>
</br>
<input type=submit name="Submit" value="Submit"></input>
<p>
Hi, you selected <%=Request("colour") %>
</p>
</form>
</body></html>
I would like to store this info into a session variable or cookie. This info is input entered by the user who fills out a form.
Is below any help?
<html><body><form>
<h2>HelloWorld<h2>
<h3>What's your favorite colour?</h3>
<select name='colour'>
<option> red</option>
<option> white</option>
<option> blue</option>
</select>
</br>
<input type=submit name="Submit" value="Submit"></input>
<p>
Hi, you selected <%=Request("colour") %>
</p>
</form>
</body></html>
try this.. this will add to session also...
<html><body><form>
<h2>HelloWorld<h2>
<h3>What's your favorite colour?</h3>
<select name='colour'>
<option> red</option>
<option> white</option>
<option> blue</option>
</select>
</br>
<input type=submit name="Submit" value="Submit"></input>
<p>
<%=Session("color") = Request("colour") %>
Hi, you selected <%=Session("colour") %>
</p>
</form>
</body></html>
You need to add an action to your form that guides the execution to a page where you store the value.
So:
<form method="POST" action="mySecondPage.asp">
...
...
</form>
And in your mySecondPage.asp you will do:
<%
Response.Cookies("myCookie Color") = Request.Form("colour").Val ue
%>
So:
<form method="POST" action="mySecondPage.asp">
...
...
</form>
And in your mySecondPage.asp you will do:
<%
Response.Cookies("myCookie
%>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To use cookies, you would do something like this -
<%
Response.Cookies("colour") = Request("colour")
%>
I beleive that this statement must be before your HTML tag though :)
<%
Response.Cookies("colour")
%>
I beleive that this statement must be before your HTML tag though :)
ASKER
Do you think I need to make use of a sessionID for this exercise?
ASKER
image.jpg