Interaction on the
World Wide Web with
the Common Gateway Interface


Process!

The Guest book form sends a very long string to the program Guestbook.cgi

WHY Perl???
  • guestbook.cgi calls the file cgi-lib.pl
  • cgi-lib.pl Reads the input from the form and puts the info into Associstive Arrays.
    • Associative arrays are Weirdo Perl constructs in which and array has a "Key" and a "Value" instead of an "Index" and a "Value" that We're used to.
      For example:
      input{key} = value
      input{name} = Dinsdale;
      print "input{name}\n";

      Prints out "Dinsdale" to the console.
      or
      print "input{Dinsdale}\n";
      Prints out "name" to the console.
Which is really cool since that's the same way Forms likes to send info!

Now we can print out data based on what "names" we used for out forms.

To return to the earlier forms:

Name

The code for this line is
Name<br> <TEXTAREA name="name" ROWS = 1 COLS = 60></TEXTAREA>

Anything that goes into the part that says "name" becomes the "key." In this case the segment "name="name"" creates a key called name and will be assigned a value of what ever you type in this box. So we get this information in our code with this:
print "input{name}\n";

Most of the rest of the program is formating and sending me a note.