Re: Pass Variables
| From: | Stephen | Date: | Mon, 06 Jan 2003 01:25:28 +0000 |
| Subject: | Re: Pass Variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130352@lists.php.net to get a copy of this message | ||
Oh yeah, forgot that the $_POST variable was an actual array already...
Thanks!
----- Original Message -----
From: "Justin French" <justin@indent.com.au>
To: "Stephen" <webmaster@melchior.us>
Sent: Sunday, January 05, 2003 7:56 PM
Subject: Re: [PHP] Pass Variables
: Assuming php > 4.1, on the script that accepts the first form's submitted
: content, you want to loop through the POST variables, and include them as
: hidden INPUTs on the second form
:
: <!-- the second form -->
: <form action="something.php" method="POST">
: <?
: foreach($_POST as $key => $value)
: {
: echo "<input type='hidden' name='{$key}'
value='{$value}'>\n";
: }
: ?>
: <!-- other form elements -->
: Your shoe size: <input type='text' name='shoe_size' value=''
size='2'><br
/>
: </form>
:
: Totally untested code (never had to do a multi-page form!!), but in
theory,
: you've got a heap of POST items in an array from the first form... all you
: need to do is include them in the second form as hidden fields, and
they'll
: become part of the second form.
:
:
: Have fun,
:
: Justin
:
:
: on 06/01/03 11:16 AM, Stephen (webmaster@melchior.us) wrote:
:
: > I want to make a function that passes all the variables in a form to the
next
: > form since the form has multiple steps. I thought about putting all the
: > contents in an array but I'd have to name out each array which would
take a
: > while and then there's the global inside the function, but again, I'd
have to
: > list all of them out. Any other quick and simple way?
: >
: > Thanks,
: > Stephen Craton
: > http://www.melchior.us
: >
: > "What's the point in appearance if your true love, doesn't care about
it?" --
: > http://www.melchior.us
:
:
: