RE: [PHP] Capturing $_POST variables
| From: | Wouter van Vliet | Date: | Fri, 28 Nov 2003 15:04:30 +0000 |
| Subject: | RE: [PHP] Capturing $_POST variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171283@lists.php.net to get a copy of this message | ||
Thorsten Körner wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Shaun
> Am Freitag, 28. November 2003 14:41 schrieb Shaun:
>> Thanks for your reply,
>>
>> I don't really need to do anything with them, just make sure they all
>> retain their original values...
>
> If you are using a form to sent the data again to third page
> you can do this foreach ($_POST as $key => $value) {
> echo "<input type=\"hidden\" name=\"".$key."\"
> value="".
> $value."\">"; }
>
> Another way is the following:
>
> $postData = $_POST;
>
> echo "<input type=\"hidden\" name=\"postData\" value="".
> $postData."\">";
>
> CU
>
> Thorsten
This won't work. $_POST is always an array. If you want to go all the way of
re-posting the postdata, this is an appraoch that would WORK. I'm not saying
it's a GOOD appraoch (as others have said, it isn't :D):
echo "<input type='hidden' name='PreviousPostData'
value='".htmlentities(addslashes(serialize($_POST)))."'>";
and on the other one
$PreviousPostData = unserialize(stripslashes($_POST['PreviousPostData']));