Here's the entire display.cgi file:
#!/usr/local/bin/perl require "subparseform.lib"; &Parse_Form; $first = $formdata{'first'}; $city = $formdata{'city'}; $food = $formdata{'food'}; print "Content-type: text/html "; print "Thank you, here is the information you entered:"; print " - First Name: $first - City: $city"; print " - Favorite Food: $food";
Let's assume the user entered the name "John," the city "New York," and the favorite food as "Pizza." Here's what John would see displayed in front of him after filling out the form:
Thank you, here is the information you entered:
You should now have a basic grasp of some of the rules of Perl and how slapping identifying "tags" on data can be useful. As you'll also learn later on, you can tell Perl to send out emails using these same variables (tags). Imagine having someone enter his email address and name, and getting an email personalized with his name in the subject line!
In the next section we'll try to drill some syntax laws into your head, explore "if," "elsif," and "else" commands, and even explore using sendmail to send out automatic confirmation/thank you emails!