Technologies Ignited

Avoid confirm form resubmission

Advertisements

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!

Advertisements

Advertisements