I am asking to see if a form could have two actions? I have created a very basic login page using php where I already know the user name and password, simply having to enter them in the correctly to reach my index page, this goes through a php check page I created to ensure both are correct using the data posted through the form on the login page against the data on the check page. I want to have a welcome message on my index page displaying the name of the user however it does not seem to be working.
login page
Name <br> <input id="name" name="name" type="text"/>
Password <br> <input id="password" name="password" type="password"/>
check page
$user=$_POST['name'];
$pass=$_POST['password'];
if(($user==$user)&&($pass=="Steveisthebest")) {
header("Location: index.php");
}
index page
echo('Welcome to my site ' . $user . ' !');
It displays the message but just not the variable obtained from the previous login page through the post action of the form.
Any help would be appreciated, fairly new to php and still learning the ropes. Thanks.