Stop resending form information

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
brandon
Forum Newbie
Posts: 6
Joined: Fri May 10, 2002 10:06 am

Stop resending form information

Post by brandon »

[removed]
Last edited by brandon on Tue Jul 14, 2015 4:35 pm, edited 1 time in total.
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

This should be fun

Post by jason »

Code: Select all

<?php

if ( isset($_POST&#1111;'submit']) )
&#123;
	/* Insert Data Here into Database */
	/* Forward your visitors onto the page you want them on */
	header("Location: name_of_page");
&#125;

/* Your page or whatever you want. */

?>
Something like this should work.

The key here is the use of header(). Just make sure you are not outputing anything before this.
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

i would reccomend making it so posting the name "name" and the message "message" won't work, because some people just like to press the submit button over and over and

name
message

will pop up alot...


also you could just put a little link at the bottom like
<a href="<?=$PHP_SELF;?>">Refresh!</a>
or in php
echo "<a href="$PHP_SELF">Refresh!</a>";
lc
Forum Contributor
Posts: 188
Joined: Tue Apr 23, 2002 6:45 pm
Location: Netherlands

Post by lc »

Ok I dunno about the code for this cause I dunno about mysql.... but personally I'd just always check the data someone sends with the last data sent.. then in case they send the exact same thing twice... give them a warning or just discard the data.

I mean after a submit get tha data last submitted and do a

if ($newdata != $olddata){
process everything
}


That should be easy enough.
Post Reply