RE: [PHP] $HTTP_POST_VARS
| From: | Brian Rue | Date: | Wed, 23 Aug 2000 22:09:02 +0000 |
| Subject: | RE: [PHP] $HTTP_POST_VARS | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-13243@lists.php.net to get a copy of this message | ||
Now it gave the error for each line that $HTTP_POST_VARS is reffered to.
-----Original Message-----
From: Joao Prado Maia [SMTP:jpm@kefta.com]
Sent: Wednesday, August 23, 2000 3:03 PM
To: Brian Rue; 'php-general@lists.php.net'
Subject: Re: [PHP] $HTTP_POST_VARS
At 03:01 PM 8/23/2000 -0700, Brian Rue wrote:
>Hi,
>
>I'm trying to cycle through the $HTTP_POST_VARS array to send the value
>for each to myself by email.
>Here's the code:
>
>$formData = "";
>while (list($key, $val) = each($HTTP_POST_VARS)) {
>$formData = $formData."$key => $val\n>";
>}
>
>mail("email","subj",$formData);
>
>When I run this code on the server, I get this error:
>Warning: Variable passed to each() is not an array or object
>
>What am I doing wrong?
Hi Brian,
Try reset()'ing $HTTP_POST_VARS before using it on your list() calls.
$formData = "";
reset($HTTP_POST_VARS);
while ( list($key, $val) = each($HTTP_POST_VARS) ) {
$formData .= $key . " => " . $val . "\n>";
}
mail("email", "subj", $formData);
Regards,
Joao
--
Joao Prado Maia
Web Developer
Kefta.com, Inc
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net