Re: $HTTP_POST_VARS
| From: | Joao Prado Maia | Date: | Wed, 23 Aug 2000 22:03:09 +0000 |
| Subject: | Re: $HTTP_POST_VARS | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13240@lists.php.net to get a copy of this message | ||
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