Re: Finding the? in $REQUEST_URI?page=blah
| From: | John Monfort | Date: | Sat, 17 Feb 2001 00:56:48 +0000 |
| Subject: | Re: Finding the? in $REQUEST_URI?page=blah | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-40273@lists.php.net to get a copy of this message | ||
Is the PHP split command the same as that in Perl?
ex.
($var_1, $var_2) = split(/:/,$string, 2);
will something like that work?
On Fri, 16 Feb 2001, ..s.c.o.t.t.. [gts] wrote:
> i'd use split, to split the value up into an array:
>
> if this is your url
> $url = "/pages/error.php?/pages/login.php?user=scott";
>
> and use this code:
> $thing = split('\?', $url);
> print $thing[0] ." <BR>\n ";
> print $thing[1] ." <BR>\n ";
> print $thing[2] ." <BR>\n ";
>
> output will be:
> /pages/error.php
> /pages/login.php
> user=scottx
>
>
>
> ----- Original Message -----
> From: "James, Yz" <liljim@btconnect.com>
> To: <php-general@lists.php.net>
> Sent: Friday, February 16, 2001 5:57 PM
> Subject: [PHP] Finding the? in $REQUEST_URI?page=blah
>
>
> > I really wouldn't ask this if I wasn't completely exausted, but the last
> > thing I feel like doing just now is reading up on this when someone can
> > probably answer it in a matter of seconds.....
> >
> > OK, I've an error handling page. Basically, I want to split (that might
> > even be one of the functions I'll have to use) this sort of url:
> >
> > error.php?/pages/login.php?username=name
> >
> > into:
> >
> > /pages/login.php
> >
> > I'm using :
> >
> > header("location: error.php?page=$REQUEST_URI");
> >
> > When echoing the request_uri back on the error page, it omits the error.php?
> > bit, so I get:
> >
> > login.php?username=name
> >
> > The reason I want to do this is so that I can use a re-login form that will
> > submit to the page the user has badly logged into, so if they logged in to
> > main.php, the request_uri would be something like:
> >
> > /pages/main.php?username=name
> >
> > Which I'd want to rebuild on the error page, into a form, like:
> >
> > <form method="post" action=<? echo "$REQUEST_URI"; /* Minus the
> > suffix the
> > page may include */ ?>">
> > Username: <input type="text" name="username"><r>
> > etc</form>
> >
> > Can anyone help?
> >
> > Thankees :)
> >
> > James.
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>