RE: [PHP] Question on query string
| From: | Ford, Mike | Date: | Tue, 16 Nov 2004 18:19:26 +0000 |
| Subject: | RE: [PHP] Question on query string | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-202191@lists.php.net to get a copy of this message | ||
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm
On 16 November 2004 16:28, Stuart Felenstein wrote:
> --- Richard Davey <rich@launchcode.co.uk> wrote:
>
>
> > Use urldecode() to get them back to "normal" again.
>
> Changed the form action line to this:
>
> action="searchresults.php?Ind=<?php echo
> urldecode(((isset($_POST["Ind[]"]))?$_POST["Ind[]"]:""))
>
>
> Still getting this:
>
> ?Ind%5B%5D=1&Ind%5B%5D=2&Ind%5B%5D=3
>
> I'm under the assumption the values get passed from
> search.php using urldecode() to searchresults.php.
> Maybe that is not the case.
URL encoding and decoding is done completely outwith PHP in this case -- the
encoding to %xx is done by the browser, and automatically decoded by the Web
server on the way through to PHP. You should never see the %xx versions in
your script, and will have no need of urldecode().
The main problem with the above snippet that I can see is that there's very
unlikely to be such a thing as $_POST["Ind[]"] -- form fields with
name="Ind[]" will turn up as an array in $_POST["Ind"]
($_POST["Ind"][0],
$_POST["Ind"][1], etc.). But the whole snippet looks very odd -- why are
you trying to pass POSTed values as GET variables on (I presume) a form
action?? Can you post a little context to the list to give us some idea
what you're really trying to do.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211