RE: [PHP] HTTP_POST_VARS

From: Date: Thu, 12 Apr 2001 20:16:30 +0000
Subject: RE: [PHP] HTTP_POST_VARS
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-48361@lists.php.net to get a copy of this message
At 4:50 PM +0200 4/12/01, Dominick Vansevenant <dv@mobyus.com> 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:mat@cryptic.co.uk] Sent: donderdag 12 april 2001 16:49 To: php-general@lists.php.net 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 | | sbedberg@ucdavis.edu Computer Consultant | | http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ | +-------------------------- www.yurisnight.net --------------------------+

« previous php.general (#48361) next »