Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 07-15-2004, 09:43 PM   #1 (permalink)
 
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  
Old 10-02-2004, 04:49 PM   #2 (permalink)
 
True Techie

Join Date: Jul 2004

Posts: 217

NeoNemesis

Send a message via AIM to NeoNemesis
Default

I believe it would look something like this:

<%
Dim FirstName: FirstName=request.form("fname")
dim lastname: lasname=request.form("lname")
response.cookies("fname")=FirstName
response.cookies("lname")=lastname
%>
__________________
<font size=\"4\" <a href=\"http://s7.invisionfree.com/NeoForum/index.php\">My Forum</a>
we are just starting out so we need you to join!
NeoNemesis is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On