<!-- NEW LINE - CREATES A FORM FIELD -->
is shown here. As we'll see, the Unix and Win32 versions are
slightly different in the extensions they will tolerate for CGI
scripts.
Unix doesn't mind what a script is called, provided it
is made executable with:
chmod +x <scriptname>
Win32 has a default
shell -- COMMAND.COM -- that will execute
batch files with the extension .bat. If you want
to use it, you don't have to specify it (see later in this
chapter):
<html>
<body>
<!-- UNIX -->
<!--TWO VERSIONS - see text above -->
<FORM METHOD=GET ACTION="mycgi.cgi">
<!-- OR -->
<FORM METHOD=GET ACTION="cgi-bin/mycgi.cgi">
<!-- WIN32 -->
<!--TWO VERSIONS - see text above -->
<FORM METHOD=GET ACTION="mycgi.bat">
<!-- OR -->
<FORM METHOD=GET ACTION="cgi-bin/mycgi.bat">
<h1> Welcome to Butterthlies Inc</h1>
<h2>Summer Catalog</h2>
<p> All our cards are available in packs of 20 at $2 a pack.
There is a 10% discount if you order more than 100.
</p>
<hr>
<p>
Style 2315
<p align=center>
<img src="bench.jpg" alt="Picture of a bench">
<p align=center>
Be BOLD on the bench
<!-- NEW LINE - CREATES A FORM FIELD -->
<p>How many packs of 20 do you want? <INPUT NAME="2315_order" TYPE=int>
<hr>
<p>
Style 2316
<p align=center>
<img src="hen.jpg" ALT="Picture of a hencoop like a pagoda">
<p align=center>
Get SCRAMBLED in the henhouse
<!-- NEW LINE - CREATES A FORM FIELD -->
<p>How many packs of 20 do you want? <INPUT NAME="2316_order" TYPE=int>
<HR>
<p>
Style 2317
<p align=center>
<img src="tree.jpg" alt="Very nice picture of tree">
<p align=center>
Get HIGH in the treehouse
<!-- NEW LINE - CREATES A FORM FIELD -->
<p>How many packs of 20 do you want? <INPUT NAME="2317_order" TYPE=int>
<hr>
<p>
Style 2318
<p align=center>
<img src="bath.jpg" alt="Rather puzzling picture of a batchtub">
<p align=center>
Get DIRTY in the bath
<!-- NEW LINE - CREATES A FORM FIELD -->
<p>How many packs of 20 do you want? <INPUT NAME="2318_order" TYPE=int>
<hr>
<!-- NEW LINES - CREATE FORM FIELDS -->
<p>Which Credit Card are you using?
<ol><li>Access <INPUT NAME="card_type" TYPE=checkbox VALUE="Access">
<li>Amex <INPUT NAME="card_type" TYPE=checkbox VALUE="Amex">
<li>MasterCard <INPUT NAME="card_type" TYPE=checkbox VALUE="MasterCard">
</ol>
<p>Your card number? <INPUT NAME="card_num" SIZE=20>
<hr>
<p align=right>
Postcards designed by Harriet@alart.demon.co.uk
<hr>
<br>
Butterthlies Inc, Hopeful City, Nevada 99999
</br>
<!-- NEW LINE - CREATES A FORM FIELD -->
<p><INPUT TYPE=submit><INPUT TYPE=reset>
</FORM>
>/body>
</html>
This is all pretty straightforward stuff, except perhaps for the
line:
<FORM METHOD=GET ACTION="/cgi-bin/mycgi.cgi">
or:
<FORM METHOD=GET ACTION="mycgi.bat">
The tag <FORM> introduces the form; at the bottom,
</FORM> ends it. The tag <METHOD> tells Apache how to
return the data to the CGI script we are going to write. For the
moment it is irrelevant because the simple script
mycgi.cgi ignores the returned data.
The ACTION specification tells Apache to use the
URL /cgi-bin/mycgi.cgi (amplified to
/usr/www/cgi-bin/mycgi) to do something about
it all:
ACTION="/cgi-bin/mycgi.cgi"
Or, if we are using the second method, where we keep the CGI script
in the htdocs directory:
ACTION="/mycgi.cgi"
The ACTION specification tells Apache to use the
URL /cgi-bin/mycgi.cgi (amplified to
\usr\www\cgi-bin\mycgi ) to do something about
it all:
ACTION="/cgi-bin/mycgi.bat"
Or, if we are using the second method, where we keep the CGI script
in the htdocs directory: