This perl program pretty much shows the cgi script but it has this note at the bottom of the page
Software error: File error, Permission denied at /Applications/XAMPP/xamppfiles/cgi-bin/asst5/orderbolts.cgi line 34.
Line 34 from cgi is this:
open (ORDERS, ">>bolts.txt") or die "File error, $!";
Here is the html file
<!doctype html>
<html lang="en">
<body>
<form action="/cgi-bin/asst5/orderbolts.cgi" method="post">
<table border="2" cellspacing="5" cellpadding="5">
<tr>
<td align="center">Name : </td>
<td><input type="text" name="customer" size="15"></td>
</tr>
<tr>
<td align="center">Street : </td>
<td><input type="text" name="street" size="15"></td>
</tr>
<tr>
<td align="center">City : </td>
<td><input type="text" name="city" size="15"></td>
</tr>
<tr>
<td align="center">State : </td>
<td><input type="text" name="state" size="3"></td>
</tr>
<tr>
<td align="center">Zip : </td>
<td><input type="text" name="zip" size="6"></td>
</tr>
<tr>
<td align="center"># of bolts : </td>
<td><input type="text" name="qty" size="4"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Check Out"></td>
</tr>
</table>
</form>
</div>
</body>
</html>
Here is the CGI file
#!/usr/bin/perl -w
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use strict;
use warnings;
print "Content-type: text/html\n\n";
my $cust = param('customer');
my $addr = param('street');
my $city = param('city');
my $state = param('state');
my $zip = param('zip');
my $qty = param('qty');
my $pay = sprintf("\$%.2f", $qty * 0.95);
print <<HERE;
<HTML>
<BODY>
<H3>Here is your order...please check</H3>
$cust<br>
$addr<br>
$city , $state $zip<br>
Number of bolts ordered : $qty<br>
Total bill for order : $pay<br><br>
<i><b>Thanks for shopping at Brad's</b></i>
HERE
open (ORDERS, ">>bolts.txt") or die "File error, $!";
print ORDERS "$cust|$addr|$city|$state|$zip|$qty|$pay\n";
close ORDERS;