1. Design the form
“Retrofix” the form data string would be as follows:
2. Write the script
The PERL script to process html form, and found a power point detailing the main steps in processing the form as follows (Heriot-Watt University, n.d.):
a. Store the form data as variable: $customer = param(”name”);
b. Print the html codes to response to the submitted data using the stored variable values: print “Dear Value Customers: ”.$customer.”
”;
c. Store the order data into database or text file for further processes using the submitted data: print OUT $customer . ” ordered a ” .$order. ” with “.$card. ” no. “.$number.”\n”;
3. Can you modify the script to process the form?
#!/usr/bin/perl
use CGI qw(:standard);
$customer = param(”name”);
$order=param(”order”);
$card=param(”card”);
$number=param(”number”);
print “Content-type: text/html\n\n”;
print “Dear Value Customers: ”.$customer.”
”;
print “Thankyou for ordering a ” .$order.” with us using your “.$card.” card.
”;
print “After payment confirmed, Your order would be delivered within 7 days.”;
open(OUT, “>>outfile.txt”);
print OUT $customer. ” ordered a ” .$order. ” with “.$card. ” no. “.$number.”\n”;
close(OUT);
The output of the Perl script “PlaceOrder.pl” would be as follows:
Content of the output file “outfile.txt” would be as follows:
Evan Burke ordered a French perfume with Visa no. 8433261344895544
Wednesday, May 13, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment