Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI and Table

Status
Not open for further replies.

samesale

Programmer
Sep 15, 2003
133
US
I have created the following to create a table. However, line # 21 gives an error. I tried everything I could think of, but not luck. Please help. I have put a number next to the line that has problems.

#!/usr/bin/perl
print "Content-type:text/html\n\n";

print &quot;<h2>Truck For Sale</h2>\n&quot;;

open(INF,&quot;truck2.out&quot;) or dienice(&quot;Couldn't open auto.out for reading: $! \n&quot;);

@data = <INF>;
close(INF);

foreach $i (@data) {
chomp($i);
($name,$add,$city,$state,$zip,$make,$photo,$model,$color,$mile,
$eyear,$price,$email,$tele,$time,$comment1,$month,$day,$year)=split(/\|/,$i);

print&quot;<table WIDTH =\&quot;100%\&quot; BORDER=\&quot;0\&quot; >\n&quot;;
print &quot;<tr bgcolor=\&quot;red\&quot;><th></th><th>Year</th><th>Make</th><th>Model</th><th>Color</th><th>Miles</th>\n&quot;;
print &quot;<th>Price</th><th>E-Mail</th><th>Telephone</th><th>Time-to-Call</th></tr>\n&quot;;
print &quot;<tr align=\&quot;left\&quot; valign=\&quot;top\&quot; bgcolor=\&quot;#FF99FF\&quot;>\n&quot;;
print &quot;<td rowspan=\&quot;2\&quot;>\n&quot;;
#21 print '<img src=&quot;/images/$tele.jpg&quot; width=\&quot;100\&quot; height=\&quot;70\&quot; align=\&quot;left\&quot; vspace=\&quot;10\&quot; hspace=\&quot;15\&quot;><\td>\n';
print &quot;<td>$eyear</td><td><font color=\&quot;blue\&quot;> $make </font></td><td>$model</td><td>$color</td><td>$mile</td>\n&quot;;
print &quot;<td>$price</td><td><a href=\&quot;mailto: $email\&quot; >$email </a></td><td>$tele</td><td> $time</td>\n&quot;;
print &quot;<tr align=\&quot;left\&quot; valign=\&quot;top\&quot; bgcolor=\&quot;#FF99FF\&quot;><td colspan=\&quot;6\&quot;>$comment1</td>\n&quot;;
print &quot;<td colspan=\&quot;3\&quot;><font color=\&quot;blue\&quot;>CODE#$tele $month-$day-$year</font></td></tr></table>\n&quot;;

}
close INF;

print <<EndHTML;
EndHTML
 
Hi,

This is more of a perl problem - you have used single quotes for the string on line 21, so the escape '\' will not work - it will be used literally and you will get width=\&quot;100\&quot; ... in your HTML.

Since you have happily used double quotes on all the other lines I would suggest you change it to this:

print &quot;<img src=\&quot;/images/$tele.jpg\&quot; width=\&quot;100\&quot; height=\&quot;70\&quot; align=\&quot;left\&quot; vspace=\&quot;10\&quot; hspace=\&quot;15\&quot;><\td>\n&quot;;

Hope this helps,
Scotty
 
Thank you. It worked. I appreciate your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top