Thread: ASP Cookies
View Single Post
Old 07-15-2004, 09:43 PM   #1 (permalink)
ESBrennan21
 
Newb Techie

Join Date: Jul 2004

Posts: 2

ESBrennan21

Default ASP Cookies

Does anyone know how to create a cookie using a variable. For example:

Code:
<form method="post" action="saveinfo.asp">
  First Name: <input type="text" name="fname">
  Last Name: <input type="text" name="lname">
  <input type="submit" value="Save Data">
</form>
If I had someone at my site fill this in, I would want a cookie saved with that information on their computer (keep in mind I don't want to save it in any type of database because this scenario is assuming they're unregistered or anonymous).

I would want to use cookies to save whatever value they enter onto their computer so I can retrieve it everytime they visit the site (this won't be a problem once they register). I would think to use this:

Code:
<%
Response.Cookies("firstname")="<% response.write(request.form("fname")) %>"
Response.Cookies("lastname")="<% response.write(request.form("lname")) %>"
%>
however ASP doesn't seem to like it. Does anyone know the proper way to do this?
ESBrennan21 is offline