How do I get my Username and password from one php page that checks to see if the username and password is correct then to another which simply prints out what the user typed in on the page before.
I don't want to use 'include' because that executes my entire php file which will not work because it runs the login form twice and it then redirects me to my invalid login form page.
On a lot of website where you login in on one page then on the next page it says welcome, your name, this is pretty much what I am trying to do.
I have tried to include it, used ob_start() and then include then ob_end_clean(), after the user types they info I tried to put that in one php file, all of these didn't work. I feel it is a lot simpler than all of this but I just don't know how to do it.
Here is my php file that checks if the username and password are correct.
<?php
session_start();
$usrArray = array("Shawn","Terri","RJ","Mark");
$pwdArray = array("sjam96","terri","rj","mark");
$usr = $_SESSION['username'];
$pwd = $_SESSION['password'];
$valid = 0;
for($i=0; $i<4; $i++){
if(($usr == $usrArray[$i]) && ($pwd == $pwdArray[$i])){
$valid = 1;
break;
}
}
if ($valid > 0){
header ("Location: futurePoolPageCheck.php");
}else {
header ("Location: Invlaid.html");
}
?>
then this is where it prints it out on the next page:
<?php
session_start();
$usr = $_SESSION['username'];
echo $usr;
echo $pwd;
?>