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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.