Re: Reading URL in address bar

From: Date: Mon, 26 Aug 2002 23:33:22 +0000
Subject: Re: Reading URL in address bar
Groups: php.general 
Request: Send a blank email to php-general+get-114201@lists.php.net to get a copy of this message
>I want to pass the current url (appearing on the browser address bar), say >http://www.mydomain.com?cat.php=234 to appear in a form field >in the a new page, say category.php. >I am sure it's something to do with HTTP_variables or CGI.referrer but can't >seem to get the one needed. Either use this in the "from" page: <INPUT TYPE=HIDDEN NAME=previous VALUE='<?=htmlentities($PHP_SELF)?>'> Or use $_SERVER['HTTP_REFERER'] in the "to" page. Or is it $_ENV['HTTP_REFERER']? I can never remember what comes from which. Use <?php phpinfo();?> to be sure. Note that some browsers may choose to give you very strange things for HTTP_REFERER, but PHP_SELF is pretty much going to be what you set it. On the other hand, it's trivial for a hacker to alter your INPUT TYPE=HIDDEN tag and send whatever they like. In either case, you can't trust the data you are getting, since any bozo could make it be anything they want. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#114201) next »