Technologies Ignited

Technologies Ignited

Avoid confirm form resubmission

with one comment

Do you know we’ve moved on a new address. There will be no new articles on this blog anymore. If you still want to keep in touch with us, follow us @ Code Mamba!You can read the same article on our new domain by clicking here!
If you have a and you want to avoid the ‘confirm form resubmission’ message on refresh you can check theese advices:
If you’re able to change the POST variables to GET variables, you can use the idea from this script:

if(isset($_POST['query']))
{
	header
	(
		'Location: ?controller=currentPage&post1='
		.$_POST['post1'].'&post2='.$_POST['post2']
	); // and so on...
	exit;
}

If you can’t convert your variables, but your view does not depend on the posted data you can use the idea from this script:

	processPostData();
	header('Location: ?controller=currentPage');
	exit;

This will redirect you to ‘?controller=currentPage’ after processing the POST data and if you refresh the page you will stay on ‘?controller=currentPage’, but you will not get the ‘confirm form resubmission’ message, because you have no post data on the redirected page.
If you can’t convert your variables and your view depends on the posted data you can try and send only flag variables. You can use the idea from this script:

	if(processPostData() == isValid())
	{
		header('Location: ?controller=currentPage&flag=1');
	}
	else
	{
		header('Location: ?controller=currentPage&flag=0');
	}
	exit;

If none of theese works, just be creative or leave me a message here!

Written by wyand

28 November 2011 at 10:24

Posted in PHP

Tagged with , ,

One Response

Subscribe to comments with RSS.

  1. if(isset($_POST[‘register’]
    {
    extract($_POST);
    $x=$_SERVER[‘REMOTE_ADDR’];
    $sql=mysql_query(“insert into messages(send_id,send_email,send_name,rec_uid,message,date,ipaddress) values (‘”.$_SESSION[‘us_id’].”‘,’$email’,’$firstname’,’$id’,’$txt’,SYSDATE(),’$x’)”) or die(mysql_error());
    header(“location:cast_detailed.php?id=$id1”);
    exit;
    }
    if i put like this the entire page is not opening.any idea?

    its displaying like this:

    Server error
    The website encountered an error while retrieving http://www.filmytalent.com/testingactivatemail/production_detailed.php?id=MTE0NA==. It may be down for maintenance or configured incorrectly.
    Here are some suggestions:
    Reload this webpage later.
    HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

    Sridhar Varma

    11 August 2012 at 08:12


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: