in reply to generarting dynamic html using perl
Keeping values across several pages:
Try to avoid the cookie route. I get more problems than solutions with cookies, especially with sites that have a lot of AOLer's and/or WebTV users as customers.
Here are the questions I ask myself when I have a form that spans several pages.
- Is it important that the user not be able do see the information they entered previously?
If you don't care if the user sees previous answers, you can stick these variables into hidden fields on the next form page. This means that you don't do any writes to your database/table until the user has completed the whole process.
- Are you worried about users 'bailing out' of the form process, and want to keep the info they DID enter?# Generate hidden fields from previous form # List all field names here @keepers = qw( first_name last_name address ); # Flip through %fields hash where you have inputs # stored, and stick them into a hidden fields foreach (@keepers){ $hidden.="<input type=\"hidden\" name=\"$_\" value=\"$fields{$_} +\"> \n"; } # Stick the $hidden variable anywhere inside the <FORM> # tags of the next page
Be sure to clean this table up occasionally because users who 'bail' will slowly fill this up with garbage. That's purely a traffic decision though. You might get away with cleaning it once a month, or be required to clean it daily with a cron job.# For this kind of operation, I like # to use a fast tie hash, especially # if there is a lot of traffic use DB_File; $records = tie %stuff, 'DB_File', "entries.dat", O_CREAT|O_RDWR,066 +6;
I hope this has helped more than muddied the question.
Richard
Oakbox
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: generating dynamic html using perl
by mr.dunstan (Monk) on Jun 15, 2001 at 02:53 UTC |