in reply to Print Array into 4 Column Table
"How can I make a PERL loop that prints my table automatically?"
You could use DBIx::XHTML_Table instead. But if you need serious flexibility, you should look into HTML::Template or Template Toolkit. But, if you don't, that first module does a pretty good job, if you don't mind me saying so myself. ;)
However, i don't like how you interpolate $FORM{state} like that. You should be providing a selectbox of states and use integers for the values. Then you could use DBI's bind vars to safely select the correct state:use DBIx::XHTML_Table; my $table = DBIx::XHTML_Table->new($dbh); $table->exec_query("SELECT city FROM speedtrap WHERE $FORM{state}"); print $table->output;
See perldoc DBI for more on bind vars.my $state_id = $params->{state_id}; #untaint $state_id somehow $table->exec_query(' SELECT city FROM speedtrap WHERE state.id = ? ',[$state_id]);
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|