RE: [PHP] Getting Variables

From: Date: Tue, 29 Aug 2000 16:53:35 +0000
Subject: RE: [PHP] Getting Variables
Groups: php.general 
Request: Send a blank email to php-general+get-14177@lists.php.net to get a copy of this message
To loop through all of the POST or GET variables do either on or the other (depending on whether your form got or posted). while (list($name,$value) = each($HTTP_POST_VARS)) { echo "$name => $value<BR>\n"; } while (list($name,$value) = each($HTTP_GET_VARS)) { echo "$name => $value<BR>\n"; } In PHP4 you can do the slightly cleaner foreach ($HTTP_POST_VARS as $name => $value) { echo "$name => $value<BR>\n"; } -----Original Message----- From: Jeroen Geusebroek To: php-general@lists.php.net Sent: 29/08/00 7:34 AM Subject: [PHP] Getting Variables Hi there, I have a form which has a lot of values; how can i check in PHP which values have been set without first knowing the name? Normaly you would do: if($a) { echo("blabla"); } But in this case i don't know the name of the variable. Any advice? Jeroen Geusebroek -- 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

« previous php.general (#14177) next »