Hello guys i have a problem with php sessions. I try to send a variable from my second page to my third page but i keep getting undefined variable i will include code from all three pages i am sorry in advance for the pretty large amount of code but i belive it will be easier for you guys to help then. Thanks in advance
PAGE 1
<form method="POST" action="authorize.php">
<input type="text" name="username" class="username"><br>
<input type="password" name="password" class="password"><br>
<label for ="remeberMe">Remember me!</label>
<input type="checkbox" name="remeberMe" class="rememberMe"><br>
<input type="submit" name="submitLogin" class="submitLogin" value="Login!">
</form>
PAGE 2
session_start();
include 'connection.php';
$user = $_POST['username'];
$pass = $_POST['password'];
$sql = mysqli_query($con, "SELECT * FROM users WHERE screename = '$user' AND ...");
$count = mysqli_num_rows($sql);
if ($count == 1)
{
$login = true;
}
else
{
$login = false;
}
if ($login == true)
{
$_SESSION['access'] = true;
$_SESSION['username'] = $_POST['username'];
header("Location:"."mainpage.php?".SID);
exit;
}
else
{
header("Location:"."index.php?");
exit;
}
PAGE 3
session_start();
if($_SESSION['access'] != true)
{
include("index.php");
exit;
}
if(isset($_POST['username']))
{
$user = $_POST['username'];
}
ERROR: $user on page 3 is undefined
$sql = mysqli_query($con,...- bad paste?authorize.php? And which values/ variables you want to pass torught which files?$sql = mysqli_query($con, "SELECT * FROM users WHERE screename = '$user' AND.... is that your code?WHERE screename = '$user' AND column = '".$_SESSION['var']."'(wink). I just like to see all the parts.