Hi Guys,
One last question for you Perl Guru's and I'll leave you boys alone...promise :)
I'm trying to figure out how to diplay the entries in a database in, say, 4 table fields instead of them being displayed vertically one.
So, here's an example of what I'm trying to accomplish:
Entry 1 Entry2 Entry 3 Entry 4
Entry 5 Entry6 Etc.
Instead of...
Entry 1
Entry 2
Entry 3
Here's what I get to work with...
&parse_form;
$database='categories.dat';
if ($input{'database'} eq ''){
$db=$database;
}else{
$db=$input{'database'};
}
open (ORGDB,"<$database");
@ODB=<ORGDB>;
close (ORGDB);
shift @ODB;
@ODB = sort(@ODB);
foreach $rec (@ODB){
chomp($rec);
($Category)=split(/\|/,$rec);
print "<tr><td valign=top width=65>
<B>Category: </B>$Category<BR></td></tr>\n";
}
sub parse_form {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
if (length($buffer) < 5) {
$buffer = $ENV{QUERY_STRING};
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$input{$name} = $value;
}
}
Thanks Again! Lisa
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.