Jump to content

SESSION Variables Lost When Form Posted


GarethB

Recommended Posts

Hi,

 

I have a feeling that this is going to be an easy miss but I've been over is a good few times and cannot see what it could be. Essentially, when I post the form in the first set of code (I've got rid of a load of unecessary html) the SESSION variables are not loaded into the second piece of code. Any ideas?

 

<?php 
session_start();
require ("connect.php");
$timeout = 1800;
$logout_redirect_url = "login.php";
if (isset($_SESSION['start_time'])) {
    $elapsed_time = time() - $_SESSION['start_time'];
    if ($elapsed_time >= $timeout) {
        session_destroy();
        header("Location: $logout_redirect_url");
    }
}
$_SESSION['start_time'] = time();
?>

<div id="leftlink">
<a href="logout.php">Logout</a>
</div>
<table align="center" width="600px" cellpadding="0" cellspacing="0">
<tr>
<td>
<h2 align="center"><a href="index.php"><img src="images/logo.jpg" border="0" /></a> <br />  Emergency</h2>
  <hr />
  </td>
  </tr>
</table>
</head>
<body>
<form action="post_reset.php" method="post" name"passre">
<table width="500" border="0" align="center" cellpadding="2" cellspacing="1">
  <tr>
    <td width="230"><div align="right">E-mail Address : </div></td>
    <td width="40"> </td>
    <td width="230"><div align="left">
<input name="email" readonly="readonly" value="<?php echo ($_SESSION['email']) ; ?>" /></div></td>
  </tr>

  <tr>
    <td colspan="3"><div align="center"><input type="submit" name="submit" value="Submit" /></div></td>
  </tr>
</table>
</form>
</body>
</html>

 

<?php
session_start;
echo ($_SESSION['start_time']);
require ("connect.php");

if (isset($_POST['submit'])){
$email = $_POST['email'];
$getde = "SELECT * FROM users WHERE email = '$email'";
$getder = mysql_query($getde, $conn);
$getdere = mysql_fetch_array($getder)

 

 

Thanks

Gareth

Link to comment
https://forums.phpfreaks.com/topic/251994-session-variables-lost-when-form-posted/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.