An Example: Survey

Our Hello World example earlier might have given you a taste of how CGI scripts work, but it was too simple to be of much use. Here's a much more complex script that handles a Web-based survey. The script keeps track of all the survey for the data, handling the input from the current form and generating tables of results based on all the data submitted so far. Figure 16.4 shows our simple survey.

Figure 16.4. A simple Web survey.

After filling out the survey, the CGI script processes the input, adds it to the data already received, and generates a set of tables, shown in Figure 16.5.

Figure 16.5. The Web survey results

All the ...

Get Sams Teach Yourself Perl in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.