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?

Member Avatar for diafol

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.

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;
	}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.