Basic HTML version of Foils prepared 23 June 1997

Foil 69 Cookies and "Hidden" Fields

From JavaScript Tutorial for Certificate Course UC Web applications Certificate -- Summer 97. by Geoffrey C. Fox, Tom Scavo


1 Cookies were introduced by Netscape to preserve client state
2 For a CGI script servicing several clients (ordering T-shirts perhaps), it is useful for the client (not server) to store information such as name of user, passwords, etc.
3 Traditionally, state variable were passed using "hidden" fields:
  • <INPUT type="hidden" name="user" value="">
  • formname.user.value = WHATHAVEYOU;
4 Such hidden fields are passed to CGI scripts in same fashion as other variables set in text fields, etc.
5 Hidden values can either by set by JavaScript on the client or embedded into a page constructed by a CGI script, which might read N values and return a new form with M new fields and N old entries preserved in hidden fields
6 So hidden variables are nice but only preserved as long as you stick to page you started with or returned by CGI script

in Table To:


Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998