rshoe has asked for the wisdom of the Perl Monks concerning the following question:
Here is my code from the cgi file:BHW1234|Drill|Black and Decker cordless drill with soft case|$79.97 BHW222|Hammer|Stanley 16-Ounce AntiVibe curved claw steel hammer|$22.4 +9 BHW2054|Handsaw|Dewalt 15 in. Hand Saw with blade armor features Tough +Coat|$18.97 BHW7048|Level|True Blue Empire level. Accuracy, durability and readabi +lity with a Lifetime Warranty. |$49.97 BHW6034|Screwdriver|Klein #2 phillips screwdriver with electrical insu +lstion.|$18.29 BHW9856|Tablesaw|Saw Stop all-purpose versatility, reliability and saf +e.|$1500.00
#!c:\Dwimperl\perl\bin\perl.exe use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use strict; use warnings; print "Content-type: text/html\n\n"; print "<html><body>"; print "<div align='center'>"; print "<h2>Bob's Hardware Tools</h2>"; print "<h3>Current Hardware</h2>"; open (HARDWARE, "inventory.txt") or die "Error opening file, $!"; print "<table border='2' cellpadding='5'>"; while(my $hardware = <HARDWARE>){ (my $sku,my $name,my $desc,my $price) = split/\|/,$hardware; print "<tr>"; print "<td><img src='$name.jpg' width='200' height='150' /></td>" +; print "<td>$sku</td>"; print "<td>$desc</td>"; print "<td>$price</td>"; } close HARDWARE; print "</table></div>"; print "</body></html>";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Display an image from cgi
by roboticus (Chancellor) on Oct 18, 2014 at 22:10 UTC | |
by rshoe (Novice) on Oct 18, 2014 at 22:59 UTC | |
by kennethk (Abbot) on Oct 19, 2014 at 15:29 UTC |