Re: [PHP-DEV] Array of setted vars by PHP From: Stig Sæther Bakken (Stig.Bakken <email protected>)
Date: 04/13/99

Bram Heerink wrote:
>
> Hey,
>
> I'm building kindoff weird script. But I don't know
> the names of the field elements that are posting to
> the PHP Script.
>
> It would be very handy to have an array of variables that
> are SETTED by PHP.
>
> For example:
>
> <input type="text" name="name">
> <input type="text" name="address">
> ...
>
> Submit Script, there's an array ... for example $PHP_Vars
>
> $PHP_Vars[0] = "name" => $name
> $PHP_Vars[1] = "address" => $address
>
> It's neat that the variables ARE set... but in this
> case I don't know their names...

There are three arrays in PHP: $HTTP_GET_VARS, $HTTP_POST_VARS and
$HTTP_COOKIE_VARS that probably are what you want. In order to have
them set, you must be running PHP with the "track_vars" php3.ini option
on, or with <?php_track_vars?> in the beginning of your script.

For a GET request you'll get a list like this:

reset($HTTP_GET_VARS);
while (list($name, $value) = each($HTTP_GET_VARS)) {
    print "$name = $value<br>\n";
}

In the future, please use php3 <email protected> for questions like this.

 - Stig

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>