954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Deny Page Refresh

Hello guys, i got a small problem here.

I can write and press "send" to submit a private message to a memeber, right... but if i refresh the page, the message gets sent again..

Anyone know a small php script i could put on top of the page to avoid script re-run?

Sorcher
Junior Poster
191 posts since Oct 2010
Reputation Points: 16
Solved Threads: 9
 

Don't send the form to itself (same page). Send it to a form handler file and then redirect back to the form page. Refresh will no longer reload said form.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

Because you haven't provided header after your logic.
Lets your page name is 'page.php'.

<?
	if(condition)
	{
		// your 
		// message
		// sending
		// code
		header("location:page.php");
		exit;
	}
?>
vibhaJ
Posting Shark
931 posts since Apr 2010
Reputation Points: 161
Solved Threads: 183
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: