RE: [PHP] refresh button will mail the form again.

From: Date: Thu, 10 Apr 2003 01:57:25 +0000
Subject: RE: [PHP] refresh button will mail the form again.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-143248@lists.php.net to get a copy of this message
Hi Mike, Thanks for your help. But if I have nothing above the header() command, how could I mail out the form data? Thanks a lot. TG -----Original Message----- From: Mike [mailto:php-digest@custom87.net] Sent: Wednesday, April 09, 2003 12:04 AM To: tiger@zhufufamily.net Subject: Re: [PHP] refresh button will mail the form again. If you refresh you are resending the post info. You need to redirect to another page once the post stuff is processed. header("location: wherever.php"), as long as you don't have anything above it ought to work. -Michael On Tue, 2003-04-08 at 20:15, Tiger Girl wrote: > Dear Sir, > > I am new to PHP, currently I just built a form and mail the result to > myself as: > in mailform.php: > <?php > if ($_POST['action'] == 'submitted') { > /* mail the form */ > } else { > } > ?> > > in form.php: > <form action="mailform.php" method="post"> > Name: <input type="text" name="personal[name]"><br> > Email: <input type="text" name="personal[email]"><br> > <input type="hidden" name="action" value="submitted"> > <input type="submit" name="submit" value="submit me!"> > </form> > > I am using PHP 4.3.1 with Apache, it works fine, but if I use the > refresh button on the browser, it will send the form again even I tried > $_POST['action'] = "FALSE". Could you please tell me what I could do to > prevent it from sending mail again? Or, just discard the form data? > > Thanks a lot. Really appreciate any help as I only know PHP for one > week. > > TG

« previous php.general (#143248) next »