There has to be a way to shorten this up but how.
sub cart_previewitem { $id = param('id'); $sth = $dbh->prepare("SELECT * FROM items WHERE id = '$id'"); $sth->execute or die $dbh->errstr; @slog = $sth->fetchrow_array; print qq~ <p><a href="javascript:history.back(1)">Back</a></p> <table align="center" width="100%" cellpadding="4" cellspacing="1" bg +color="#000000"> <tr> <td class="darktext" bgcolor="#FFFFFF"> <font size="2"><b>$slog[2] - $slog[4]<br></b></font> <table align="center" width="100%" cellpadding="4" cellspacing=" +0"> <tr> <td align="center" bgcolor="#FFFFFF"> ~; if($slog[19]) { print "<img src=\"$slog[19]\" border=\"1\">"; } print qq~ </td><td width="100%" bgcolor="#FFFFFF" class="darktext" valign +="top"> <p><b>Description:</b> $slog[5]<br> <b>Price:</b> $slog[3] ~; if($slog[6]) { print "<br><b>Size:</b> $slog[6]"; } if($slog[13] && $slog[14]) { print "<br><b>$slog[13]:</b> $slog[14]"; } if($slog[15] && $slog[16]) { print "<br><b>$slog[15]:</b> $slog[16]"; } if($slog[17] && $slog[18]) { print "<br><b>$slog[17]:</b> $slog[18]"; } print qq~ </p> </td> </tr> </table> ~; if($slog[7] && $slog[8]) { (@nslog) = split(/\n/, $slog[8]); print "<br><b>$slog[7]:</b> <select name=\"$slog[7]\">"; foreach $line (@nslog) { print "<option value=\"$line\">$line</option>"; } print "</select>"; } if($slog[9] && $slog[10]) { (@nslog) = split(/\n/, $slog[10]); print "<br><b>$slog[9]:</b> <select name=\"$slog[9]\">"; foreach $line (@nslog) { print "<option value=\"$line\">$line</option>"; } print "</select>"; } if($slog[11] && $slog[12]) { (@nslog) = split(/\n/, $slog[12]); print "<br><b>$slog[11]:</b> <select name=\"$slog[11]\">"; foreach $line (@nslog) { print "<option value=\"$line\">$line</option>"; } print "</select>"; } print qq~ </td> </tr> </table> ~; }

In reply to shortin this code up by andrew

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.