Jump to content

Recommended Posts

Are you posting data from a form to a script? Because if you are and you try to go back to that page IE may prevent your page from initially displaying, unless you confirm you want to post the data again.

 

yup, it's a form that will post data...so, you meant this is normal for IE and can't be prevent? when i refresh the page, then the data will be resend again...

yup, it's a form that will post data...so, you meant this is normal for IE and can't be prevent? when i refresh the page, then the data will be resend again...

 

To prevent it you can do a header redirect to a "thank you" page. Doing this redirect will clear the POST data.

yup, it's a form that will post data...so, you meant this is normal for IE and can't be prevent? when i refresh the page, then the data will be resend again...

 

To prevent it you can do a header redirect to a "thank you" page. Doing this redirect will clear the POST data.

 

ya, currently after the form is submitted, then it'll be redirect to the main page. my problem is sometimes user press the 'back' button, intend to get back the form again, that's why the problem arise...

If you do a header redirect immediately after the form is submitted, it should wipe clean the data from POST.

 

Something like this:

 

<?php
$action = isset($_GET['action'])?trim($_GET['action']):'index';
$action = strtolower($action);

switch ($action) {
    case 'input':
           // enter data here
          header('Location: page.php?action=thanks');
    break;
    case 'thanks':
           echo "Thank you for submitting data.";
    break;
    default:
    case 'index': 
           echo 'Please fill out the form and click submit';
    break;

}
?>

 

A simple example, but that should clear the post data for when a user clicks back.

If you do a header redirect immediately after the form is submitted, it should wipe clean the data from POST.

 

Something like this:

 

<?php
$action = isset($_GET['action'])?trim($_GET['action']):'index';
$action = strtolower($action);

switch ($action) {
    case 'input':
           // enter data here
          header('Location: page.php?action=thanks');
    break;
    case 'thanks':
           echo "Thank you for submitting data.";
    break;
    default:
    case 'index': 
           echo 'Please fill out the form and click submit';
    break;

}
?>

 

A simple example, but that should clear the post data for when a user clicks back.

 

please forgive my ignorant, may i know what $_GET['action'] meant? it's from my submit button?

It was just a rough example. Basically it is a way to execute different code on the same page.

 

It does not "have" to be setup that way. What I am getting at, is after your code processes from the submit button do an immediate header redirect and it should take care of the going back and re-posting the data.

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.