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');

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.