RE: [phplib] php4/win2K/Query_String From: Adam Robertson (adam <email protected>)
Date: 06/11/01

Hi John,

I'm not really sure what your trying to do here, there is normally no reason
to parse_str the Query String.

When you do have a query string input on your page, parse_str is run on it
automatically so that with the page:
index.php?foo=bar
you will already have the variable $foo with the value "bar" when the script
starts. There is no need to re-parse the query string as you'll just be
re-creating the same variables.

If for some reason you do still want to do this, how about:

if (is_string($HTTP_SERVER_VARS['QUERY_STRING']))
        parse_str ($HTTP_SERVER_VARS['QUERY_STRING'];

to check if the string is valid before parsing it.

HTH,
Adam Robertson
Internet Developer

Random Media
14 South Audley Street
Mayfair
London W1K 1HN
t.+44 (0)20 7923 4298
f.+44 (0)20 7598 8826
www.randommedia.co.uk

> -----Original Message-----
> From: John Lucas [mailto:lucasj <email protected>]
> Sent: 11 June 2001 14:27
> To: phplib <email protected>
> Subject: [phplib] php4/win2K/Query_String
>
>
> Hi there,
>
> I am new to PHP however I am finding it great fun.
>
> The current problem I am having, which I hope someone can
> assist with, is
> when I try and parse the Query_String:
>
> parse_str ($HTTP_SERVER_VARS['QUERY_STRING']);
>
> I get a parse error if there is no Query_String present.
>
> Any suggestions please?
>
>
> Regards
>
>
> John Lucas
>
> PS: Please note my new email address!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: phplib-unsubscribe <email protected>
> For additional commands, e-mail: phplib-help <email protected>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>