Posted by Jeremy on 12/13/06 21:04
Curtis wrote:
> Use $_SERVER['PHP_SELF'] or $_SERVER['SCRIPT_NAME']. Neither of these
> include the query string.
>
But neither of these will actually return the request URI; they will
only return the filename and/or path of the script.
Example:
..htaccess:
-----------------------
RewriteEngine On
RewriteRule ^foobar$ /foobar-script.php
foobar-script.php (accessed by URI /foobar)
-----------------------
<form action="<?=$_SERVER['PHP_SELF']?>">
<input type="text" />
<button type="submit">Submit</button>
</form>
Whoops! The form now submits to /foobar-script.php instead of /foobar.
Jeremy
[Back to original message]
|