I have a login page where the user has to provide his/her credentials and then log in to the page named dashboard.php.
Now the credential validation is done on this page.I used $_POST to pass the variables. If user credentials are not correct then he is taken back to index.php. Else the page is filled with user data from the db.
Now the problem is that when user revists dashboard.php from any other page (other than index.php) How do I get the same credentials back so as to show the contents related to the user? I tried using session variables by saving the credentials in them but still not working.
I have added a sample code of what I have done:
index.php
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form action="dashboard.php" method="post">
<input type="text" name="txt">
<input type="submit">
</form>
</body>
this travels to dashboard.php which is:
<?php
session_start();
if(isset($_SESSION['LOG_IN'])!=1)
{
$xt = $_POST['txt'];
$_SESSION['LOG_IN']=1;
}
?>
<html>
<head>
</head>
<body>
<p> HI </p>
<a href="3.php"><?php $xt ?>Link of 3.php</a>
</body>
</html>
and now when i go to some page called 3.php and press the back button. I get the form re-submission page.