O'Reilly logo

Sams Teach Yourself CGI in 24 Hours, Second Edition by Rafe Colburn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Checkout Script

In Hour 16, I didn’t write code to do anything with the order information the user entered after the checkout form was processed. In this hour, I’m inserting the order data into the database, so you can see how the back-end processing often works for online stores. As you’ve probably guessed, I had to make the same changes to this script that I had to make to the other scripts in order to get them to talk to the database. Before I look at the script’s new functionality, let’s look at the source code, which appears in Listing 20.5.

Listing 20.5. The Source Code to checkout.pl
 1: #!/usr/local/bin/perl 2: 3: use strict; 4: 5: use CGI; 6: use CGI::Carp qw(fatalsToBrowser); 7: use DBI; 8: 9: my $query = new CGI; 10: 11: my $database ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required