Re: Getting current page details
| From: | Brad Thomas | Date: | Tue, 10 Jun 2003 01:19:39 +0000 |
| Subject: | Re: Getting current page details | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-20257@lists.php.net to get a copy of this message | ||
I've found that the following line is useful for tracking where a user has
originated from:
$url = urlencode (basename($_SERVER['PHP_SELF']) . "?" .
$_SERVER['QUERY_STRING']));
Firstly, we'll urlencode the value so it can be used in a form, or as an
extra parameter in the URL.
Then we take the basename of the current script pathname (ie /foo/bar.php
becomes bar.php)
append the question mark for the query string onto it, and then finally the
query string values
Brad
"Rotsky" <rotsky@wanadoo.fr> wrote in message
news:20030309124439.31722.qmail@pb1.pair.com...
> I'm using a login routine and I'd like to return the user to the page
where
> they started before going to the login form. I figured I could do this by
> grabbing the current page details, putting these into a session variable
and
> using that to link back to the page later.
>
> So the question is, how do I get the current page's details? I suspect
some
> might say PHP_SELF contained in the $_SERVER array - is this the best way?
>
>