Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


CGI: State

Some user interactions can be dealt with in one action, e.g. user fills in a comments form that's emailed to you. Others need a sequence of actions, one feeding the next, e.g. browsing a virtual mall and filling a virtual trolley; a list of items in the trolley needs to be kept somewhere.

"State" is usually a collection of facts that you need from one transaction to the next one for that user, e.g. the list of items selected so far. You can either send that whole collection to the client, for them to echo back when ready; or, you can store them, e.g. in a file, and tag them with a unique identifier.

This can easily be done using a sequential number generator, like the visitor counter. You name that file with the id, and pass it to the client, in the HTML. However you then have to take care of housekeeping the state files, e.g. by periodic clean-up tasks.

Instead of sequential numbers, you might use something else, e.g.

	# No client-side state!
	$file   = "/tmp/".$ENV{'REMOTE_HOST'}; 
..but it might not be unique..
  • Hidden Variables.
    	<FORM	...>
    	<INPUT TYPE="hidden" NAME="Sid" VALUE="8663">
    	</FORM>
    
  • Path Info in hyperlink URLs.
    	<A HREF="/cgi-bin/prog?Sid=8663">
    		Click Here!</a>
    
  • Path Info in the Form action URL.
    	<FORM	ACTION="/cgi-bin/prog?Sid=8663">
    	...
    	</FORM>
    


Up to => Home / Authoring / CGI / Process




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers