Jump to content

Working with sessions in form - can I cleared sessions without closing window?


iconicCreator

Recommended Posts

I'm using session to indicate senders name on a form confirmation page.

So if the user submits a page, the form is redirected to a confirmation page.

 

The problem is if you don't manually clear the cookies and you send the page again, the old name still goes to the confirmation page even if you typed a new name.

 

The idea of using the user first name on the page was to make it "more personal."

Like Thanks BOB for your message:

 

Is there a way around this?

 

 

This is the confirmation page code:

 

<?php 
session_start(); // at the top again
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Confirmation - Thanks for the feedback!</title>
</head>

<body>
<div class="confirmation">Thanks <span class="sendersName"><?php echo isset($_SESSION['firstName']) ? $_SESSION['firstName'] : '' ?></span> for evaluating our product, we will contact you within 24 hours.</div>
</div>
</body>
</html>

 

And this code is in the form and Session start is at the top:

 

$_SESSION['firstName'] = $firstName;
   header('Location: http://www.confirm.com/confirmation.php');

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.