Just generate the form in pure Perl!
Each time your click to 'add/edit/delete' the entire form data will be sent to your cgi script. Use Perl to update and send the updated form back to the browser. When the final form is complete have a button to 'SAVE' the contents of the form, and at that time also save the updated information to your database.
This is personal preference, but use a hash to save the data, so that fields of the form are like 'field1', 'field2', etc. This allows you to reformat the fields each time the form is sent. You need the number (1..n) to maintain the order of the data.
use strict; my $fields = ""; # input from web form my $sep = chr(254); # something unique could be '%%%' need to up +date form my $text = ""; # html document ( could be read from file ) # on return just send to browser my %TWORK = (); # Processed fields from form Template(\$text,\%TWORK,$sep); print qq|Content-type: text/html\r\n\r\n $text \r\n\r\n|; sub Template { my $text = shift; my $hash = shift; my $sep = shift; $$text =~ s{ $sep ( .*? ) $sep } { exists( $hash->{$1} ) ? $hash->{$1} : "" }gsex; }
I can't take credit for the 'sub', I think I found it on PM, but what a great tool to add to your saved scripts. I use this tool whenever I don't know how big the form will be, and it just keeps on working. You need to add more code to get this working, but hopefully you'll have a good start now.
Good Luck
"Well done is better than well said." - Benjamin Franklin
In reply to Re: Save data from a dynamic HTML table into database
by flexvault
in thread Save data from a dynamic HTML table into database
by josef
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |