<a href="cgi-bin/feed.cgi?grapes">Hot text</a>
Click to feed the script grapes
Click to feed the script raisins
Click to feed the script garbage
echo "Content-type: text/plain"
echo ""
echo "Thank you for feeding me: "
echo $QUERY_STRING
Quite true. It's only the QUERY_STRING mechanism that this demonstrates (although you may find uses for even this simple input mechanism).
<FORM METHOD=GET ACTION="cgi-bin/fooditem.cgi">
Grapes <INPUT TYPE="radio" VALUE=grapes NAME="foodtype">
Raisins <INPUT TYPE="radio" VALUE=raisins NAME="foodtype">
Garbage <INPUT TYPE="radio" VALUE=garbage NAME="foodtype">
<INPUT TYPE="submit" VALUE="Submit">
</FORM>
Source for fooditem.cgi
Simple submissions like the following are also fairly easy to deal with:
<FORM METHOD=GET ACTION="../../cgi-bin/phonenum.cgi">
Phone number:
<INPUT TYPE="text" SIZE=16 NAME=phonenum>
<INPUT TYPE="submit" VALUE="Submit">
</FORM>
In this case the QUERY_STRING variable is going to contain both the name, phonenum,
and the number:
QUERY_STRING=phonenum=1234567So, if we want to keep a list of the phone numbers, we may want to reformat:
set JUSTNUM = `echo QUERY_STRING | sed s/phonenum=//`
The above "stream editor" command, added to the phonenum.cgi script will strip off the name of the variable, leaving just the number, which can then be added to a data file:
cat $JUSTNUM >> /home/chingon/blackbook
Source for phonenum.cgi
Source for form.cgi is here
<FORM METHOD=GET ACTION="cgi-bin/choice.cgi">
<SELECT NAME="NUM_MENU">
<OPTION>ONE
<OPTION>TWO
<OPTION>THREE
<OPTION>FOUR
</SELECT>
<INPUT TYPE="submit" VALUE="Submit choice">
</FORM>
Source for choice.cgi is here