I have a huge form that takes place over several pages.  Well, actually 
it's one script that calls itself many times.  Passing the user data 
from one instance of the script to another has certainly been 
educational.  (I am avoiding session variables for this particular 
form.)  I finally have the data display itself in a "Confirm?" page 
instance, where all of the data aggregated is displayed for the user to 
confirm.  But I need to pass this data ONE MORE TIME to the part of the 
script that actually adds it to the database.

Two questions about this:

1) most important question -- what is the most efficient way to pass 
this POST data from the "confirm" page to the "add to database" page?  I 
was thinking of creating an array to contain the many POST variables, 
like this:

$superformfield = array();
$superformfield[] = $_POST['name'];
$superformfield[] = $_POST['size'];
$superformfield[] = $_POST['resolution'];
$superformfield[] = $_POST['creator'];
... etc ...

Then taking $superform and placing it into a hidden form field, rather 
than creating a new hidden form field for every single variable that I 
want to pass.  Is this when people use serialize() ?  Demetrious S. 
Kelly posted a function "encode()" which takes data and translates it to 
ASCII numbers so that it becomes hidden-form-field-friendly.  I'm 
guessing the best thing to do is serialize() the data, then translate it 
into ASCII numbers only, then store all of this info into one giant 
hidden form field.  I'm hoping there's no limit on hidden form field 
size... then use Demetrious's decode() function on the next 
instance/"page" of the script, to return the data to its original 
characters and unserialize() -ing the characters to get my array back.  
Then I can loop through the array and create my SQL statement.  Does it 
make any sense?

2) is this a lot of extra work, and I'd be better served by just taking 
each variable and putting it into its own hidden form field?


"And remember, your answer is for posterity, so please try to be honest."
-- the Six-Fingered Man



Erik Price
Web Developer Temp
Media Lab, H.H. Brown

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to