At 4:50 PM +0200 4/12/01, Dominick Vansevenant <[EMAIL PROTECTED]> wrote:
>Mat,
>
>did you put in a reset?
>
>reset($HTTP_POST_VARS);
>
>D.
Yes, you'll need the reset() there if you're looping through the
$HTTP_POST_VARS array more than once. However:
I take it that you were trying something like
echo $HTTP_POST_VARS[0];
? If so, you will indeed get the output 'array' if element 0 is an
array. As someone suggested, you can use the print_r() or var_dump()
functions (print_r, I think, is PHP4 only) to display it. You can
also do something like
...
if (is_array($HTTP_POST_VARS[0])) {
while (list($k,$v)=each($HTTP_POST_VARS[0])) {
echo '$HTTP_POST_VARS[0]', "[$k] = $v<br>";
}
} else {
echo '$HTTP_POST_VARS[0] = ', $HTTP_POST_VARS[0];
}
...
In PHP3, POST/GET elements could only be one dimensional arrays, at
most. In PHP4, though, these can have 2+ dimensions, so for maximum
generality you'd have to have somewhat more complex code than this.
-steve
>-----Original Message-----
>From: Mat Marlow [mailto:[EMAIL PROTECTED]]
>Sent: donderdag 12 april 2001 16:49
>To: [EMAIL PROTECTED]
>Subject: [PHP] HTTP_POST_VARS
>
>
>Hi all,
>I'm having trouble retrieving data from $HTTP_POST_VARS. Whenever I try to
>print something from it using print($HTTP_POST_VARS[0]); it just prints
>"Array". And I know it works because I've done it once and can't do it
>again!
>Am I missing something glaringly obvious?
>
>Thanks for the help,
>
>Mat
>PS. track_vars is ON!
>
--
+----------- 12 April 2001: Forty years of manned spaceflight -----------+
| Steve Edberg University of California, Davis |
| [EMAIL PROTECTED] Computer Consultant |
| http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ |
+-------------------------- www.yurisnight.net --------------------------+
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]