On Thu, 16 Sep 2004 12:47:26 -0700 (PDT), Chris Shiflett <[EMAIL PROTECTED]> 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