|
Web Page Design
Forms: Start with Content and Structure
will follow
Forms are easy to design with any of the WYSIWYG editors
What happens when the user hits a
'submit' button?
-
Contents of the form are sent back to a web server
-
Web server runs the CGI script and does something with
the contents of the form
-
The CGI script then sends back ASCII text that defines
the web page the user will next see.
What's a CGI script?
-
Written in any computer language (usually Perl,
C-Shell script, Tcl, sometimes even Fortran!)
-
Accepts text from standard input
-
Understands the syntax of CGI so that it can interpret
the input
-
Writes to standard output a proper HTML page
-
Placed in a special area so that the web server can
find and run it when a user calls for it
#!/opt/local/bin/tclsh
#
set text [read stdin ]
exec /usr/ucb/mail rmaddale@nrao.edu << $text
#
puts "Content-type: text/HTML\n"
puts "<HTML>"
puts "<HEAD>"
puts "</HEAD>"
puts "<BODY>"
puts "Thank you for submitting this form"
puts "</BODY></HTML>"
Produced the following mail message:
From nobody@sadira.gb.nrao.edu Thu Feb 18 11:11
EST 1999
X-UIDL: 651bad9a58ba02bf74ea94c21754bea4
Date: Thu, 18 Feb 1999 11:11:38 -0500 (EST)
From: Nobody <nobody@sadira.gb.NRAO.EDU>
To: rmaddale@nrao.edu
Text=This+is+a+test
|