RE: [PHP] checking multiple URL parameters
| From: | Gryffyn, Trevor | Date: | Thu, 16 Sep 2004 20:52:58 +0000 |
| Subject: | RE: [PHP] checking multiple URL parameters | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-196918@lists.php.net to get a copy of this message | ||
Ahh.. Andrew has read my confused mind. Yeah, that's what I was getting
at. Solution Accepted or something. :) Ok, I'm going to go home now
before I cause any more problems.
-TG
> -----Original Message-----
> From: Andrew Kreps [mailto:andrew.kreps@gmail.com]
> Sent: Thursday, September 16, 2004 4:31 PM
> To: PHP
> Subject: Re: [PHP] checking multiple URL parameters
>
>
> On Thu, 16 Sep 2004 12:47:26 -0700 (PDT), Chris Shiflett
> <shiflett@php.net> wrote:
> >
> > This makes absolutely no sense to me. What do you mean by
> submitted? How
> > would a PHP script be executed at all if the browser never sends a
> > request?
> >
>
> PHP can be run from the command line, in which case the GET and POST
> arrays wouldn't exist. I use this functionality so that I can take
> advantage of Pear's DataObjects when I need to do a flat file data
> load. Also, imagine if you had a database of URL's that you wanted to
> dissect for it's component information?
>
> That being said, I'm not aware of a PHP function that performs this
> operation for you. I remember writing a similar one in Perl many
> years ago, that was something like:
>
> (sorry for the pseudocode, I figure completely wrong is better than
> almost right)
>
> array = regexp_split (/[=&]/, uri) // where uri is everything
> after the ?
> for (i = 0; i < count(array); i += 2) {
> url_var[array[i]] = array[i+1] // You may want to do a
> urldecode here
> }
>
> I believe php lets you name vars by adding an additional $ before the
> name, such as:
>
> $varname = "thing";
> $$varname = "data";
> echo $thing // Produces 'data'
>
> This may be a good starting point.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>