Hello. I have this login page, where I am getting the ID and Password from the index.html.
Now it is setup, that when I input the id and password in the index.html, the values is send to login.html, that is calling the function login and checks for valid login.
If the login is valid then:
echo "<h1>Welcome: </h1><h4>".$_SESSION['session_member_first_name']."</h2><a href = 'welcome_member.php'> Click here </a>";
What I wanted to do, is to include this code, so that it will automatically redirect to the welcome_member.php, but it doesn’t work:
header('Location: welcome_member.php');
How can I do this?
This is the full page:
<div class="row">
<div class="center-div">
<?php
require ('./database_initialisation.php');
$id = $_POST['inputID'];
$pass = $_POST['inputPassword'];
$member = $_POST['appUser'];
if ($member == 'Member' )
{
$member_query->logIn($id, $pass);
if(isset($_SESSION['session_member_first_name']) )
{header('Location: welcome_member.php');
//echo "<h1>Welcome: </h1><h4>".$_SESSION['session_member_first_name']."</h2><a href = 'welcome_member.php'> Click here </a>";
}
else {echo "Credential do not match out database records";}
}
elseif ($member == 'Employer')
{
$admin_query->logIn($id, $pass);
if(isset($_SESSION['session_employer_first_name']) )
{header('Location: welcome_employer.php');
//echo "<h1>Welcome: </h1><h2>".$_SESSION['session_employer_first_name']."</h2><a href = 'welcome_employer.php'> Click here </a>";
}
else {echo "Credential do not match our database records";}
}
else
{ echo "Could not log In";} ?>
</div>