cookies tutorials?

jlknauff

Expert

Posts: 501

Loc: Florida

3+ Months Ago

can anyone tell me where to find a tutorial on making a cookie with CGI? What I need to do is collect data as a visitor goes through my site and when they are done submit it through sendmail. I can do the last part but can't find how to collect and store the data before it is sent. Thanks in advance guys.

rjstephens

Professor

Posts: 774

Loc: Brisbane, Australia

3+ Months Ago

what data do you want to collect?

A cookie is a piece of information that your server sends to the user and that the user send back on each subsequent page request.

The only way to get a user's information from a cookie is if you already know it and have sent it to the user in a cookie. To do taht you would probably need them to fill in a form of some description.

What language are you using? IF its perl then have a look at the CGI::Cookie module.

Managedlinks

Proficient

Posts: 294

3+ Months Ago

If I was doing what you asked I would use javascript to store the information in a cookie. I wouldn't use CGI until perhaps the last step i.e. sending the form.

On each page a small script appends the page information to a cookie

When the user is ready to submit the information then another small script ads it to the form which is then sent to the server for mailing or even sent directly using a simple "mailto" action

Managedlinks

Proficient

Posts: 294

3+ Months Ago

here are a couple of javascript functions to help in setting and getting the cookies