Nevtlathiel has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to write a small CGI script which will allow a user to add records to a database by filling in an html form. The form is generated dynamically by getting all the columns from the database along with their types and maximum lengths (where appropriate). The input type is then converted into something suitable for hmtl input (since the database has more then one type of field for which the input is best represented as a textfield in the html) and stored in a hash with column names as keys and the input types as values. The form is generated within a table and should call on the hash to get the right type for the query like this:
print start_Tr, start_td; print "$req$key: "; print end_td, start_td ($query->$input_html{$key}("$key") ); print end_td, end_Tr;
I'm aiming for something like:
<tr> <td>$req$key:</td> <td> <input type="$input_html{$key}" name="$key"> </td> </tr>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using hash values as CGI query types
by shenme (Priest) on Jan 28, 2005 at 12:06 UTC | |
by Nevtlathiel (Friar) on Jan 28, 2005 at 12:14 UTC | |
|
Re: Using hash values as CGI query types
by davis (Vicar) on Jan 28, 2005 at 12:05 UTC | |
by shenme (Priest) on Jan 28, 2005 at 12:16 UTC | |
by davis (Vicar) on Jan 28, 2005 at 12:19 UTC |