Aaron, CC Zona wrote before that:
If track_vars is on (always true if version >= 4.0.3), then the global vars
$HTTP_GET_VARS['bob'] and $HTTP_GET_VARS['phil'] are already set.
And if register_globals is on, then the global vars $bob and $phil are also
already set.
--------------------------------------
Taking from your original post -
file.php?bob=manager&phil=employ
If you create a file.php in your server, and hit it with
file.php?bob=manager,
you should just be able to say
<? echo $bob; ?>
and you'll get "manager" printed out for you. Most installations of
PHP, by default,
create variables for you from the GET string parameters. There can be a
security concern
if you're not careful to validate the data that you get in from those
GET strings,
but this 'ease of use' (not having to use that Perl stuff from below, or
firing up CGI.pm
every request) is one of the main attractions to PHP for beginning
developers.
CC Zona also wrote that you can use the $HTTP_GET_VARS array (which would
be the equivalent to the $fields{} array that is created below. One really
nifty thing about PHP that isn't addressed in your Perl snippet below is
arrays -
file.php?name[]=mike&name[]=dave&name[]=keith
would give me an array called $name with 3 elements in it. There's most
likely
a Perl module to handle that (does CGI.pm handle that) but it's handled
automatically
in PHP.
Aaron Moore wrote:
>Well hers teh perl version of the the parser... how do i convert this to php
>
>$tmp = $ENV{'QUERY_STRING'};
>@pairs = split(/&/, $tmp);
>
>foreach $item (@pairs) {
> ($key, $content) = split(/=/,$item,2);
> $content =~ tr/+/ /;
> $content =~ s/%(..)/pack("c",hex($1))/ge;
> $fields{$key} = $content;
>}
>
--
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]