Re: Getting Variables
| From: | Cody Caughlan | Date: | Tue, 29 Aug 2000 14:39:31 +0000 |
| Subject: | Re: Getting Variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14133@lists.php.net to get a copy of this message | ||
If you use GET or POST then upon submission, PHP stuffs all the form
variables in an array
$HTTP_POST_VARS and $HTTP_GET_VARS.
So what you could do is cycle through the appropriate array like this
looking for values:
while(list($key, $val) = each($HTTP_POST_VARS))
{
if($val != "")
{
${$key} = $val;
print "$key is set to $val<BR>";
}
}
#now by the output of this script you can tell which variables are good,
the ones that have been outputted and the ones that have been
"generated" with the ${$key} operator (operator?)...
instead of printing them you can either do something with them in the
2nd brace structure or maybe push them onto an array of known good keys
and values and work with that array which you have just done "quality
assurance" with...
good luck
/Cody Caughlan
Jeroen Geusebroek wrote:
>
> 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
-