RE: [PHP] Re: From form to an array

From: Date: Mon, 17 Nov 2003 21:57:14 +0000
Subject: RE: [PHP] Re: From form to an array
Groups: php.general 
Request: Send a blank email to php-general+get-170020@lists.php.net to get a copy of this message
Jay Blanchard wrote: > [snip] > Ok, now on submit of this second form I want to take field1 > from each line and put it into $array1 and field2 from each > line and put it into $arrray2. > [/snip] > > Form 1's info would have to be held as hidden fields in Form > 2's construction. An example ... > > /* formOne.php */ > <form action="nextForm.php" method="POST"> > <input type="text" name="formOneArray[]"> > <input type="submit"> > </form> > Jay, Sorry but I don't follow what your doing here. Form one doesn't need an array, it only has one piece of data, the number of rows that form2 should have. > /* nextForm.php */ > <form action="processForms.php" method="POST"> > <input type="text" name="formTwoArray[]"> > <input type="text" name="formTwoArray[]"> > <input type="hidden" name="formOneArray[]" value="<?php > echo $_POST['formOneArray[0]']; ?> </form> > > Not tested, but should be pretty close Form two has 2 fields for every line and the fields need to be kept in separate arrays. /* form2.php */ <form action="<?PHP Echo $_SERVER['PHP_SELF'] ?>" method="POST"> <input type="hidden" name="tiers" value="<?PHP ECHO $_POST['form1info'] ?>"> <input type="text" name="tier[]"> <input type="text" name="price[]"><br> <input type="text" name="tier[]"> <input type="text" name="price[]"><br> <input type="text" name="tier[]"> <input type="text" name="price[]"><br> <input type="submit" name="submit" value="submit"> </form> Does that make more sense or am I just not understanding what your trying to do? Thanks, Jeff

« previous php.general (#170020) next »