PHP_SELF
Moderator: General Moderators
-
kkurkowski
- Forum Commoner
- Posts: 53
- Joined: Mon Dec 09, 2002 4:44 pm
- Location: Michigan
PHP_SELF
Do you know the command that gets the website that you are already at. Say on my site I have the login on every page and when they login it automatically goes to the news.php page. Does anyone know the command so that it goes back to the page that they were at when they are logged in?
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
if you want users to return to the page they logged in from you could have your form something like this.
**edit** for some reason the <? echo $PHP_SELF ? > isn't showing the ?>
then in your login page have something like this
**edit** for some reason the <? echo $PHP_SELF ? > isn't showing the ?>
Code: Select all
<form method="post" action="login.php?page=<? echo $PHP_SELF ?>">
<input type="text" name="name">
<input type="password" name="pass">
<input type="submit" value="login">
</form>Code: Select all
$page = $_GET['page'];
your validation script here, if valid do this
Header("Location: $page");