[thelist] ASP cookies

Feingold Josh S Josh.S.Feingold at irs.gov
Thu Sep 19 13:49:09 CDT 2002


--
[ Picked text/plain from multipart/alternative ]

> The idea is when a user puts an email address in a form the cookie
remembers the address.

Step One: Create the cookie.  Call it email.

> In this application the user would return to the form often and be using
multiple addresses
>over time.

Step Two: Every time the user adds an email address, read the existing
cookie, concate a ";" at the end of the string, then add the new email
address.  Now your cookie called email has multiple email addresses,
seperated by a semicolon.

> Then I want to take the cookie and make a list of addresses so the user
can select one to
> populate the form rather than typing it out.

For this you will read the cookie, split it into an array, then use a loop
to write the option values of the select box.

<air script>
<%
splitEmail = split(request.cookie("email"),";")
%>

<select name="emailAddresses">

<%
for x = 0 to ubound(splitEmail)
	response.write "<option value=""" & splitEmail(x) & """>" &
splitEmail(x)

next
%>

</air script>

HTH,
josh



More information about the thelist mailing list