Re: General use of rewrite / redirect

From: Date: Tue, 18 Mar 2008 15:01:21 +0000
Subject: Re: General use of rewrite / redirect
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-271734@lists.php.net to get a copy of this message
On 18 Mar 2008, at 14:49, Jason Pruim wrote:
On Mar 18, 2008, at 10:11 AM, Per Jessen wrote:
Per Jessen wrote:
My typical setup for a form-page probably looks like this: if ( $_POST ) {
      // do POST processing
      header(303 thankyou.html).
      exit
}
If I wanted the user back on the same form page, but still with a "thank you" message, I'd still do a 303, but use $_SESSION to indicate that the user needs a "thank you" message displayed.
Just to play devils advocate and to try and understand things better... Is there any reason you couldn't do a simple: $formsubmitted= true; if($formsubmitted = true){ Thank you for giving the bad guys your credit card number hahahahahah! }else{ echo <<<HTML <P>Give me your credit card number or I'll force you to eat raw spam all day!</P><input type="text" name="txtCC" } Or something like that :)
Because if the user reloads that page you'll process the form again, which could have any number of nasty effects from creating a duplicate row in the database to charging a credit card again. It also causes a potentially confusing confirmation request to be displayed to the user. -Stut -- http://stut.net/

« previous php.general (#271734) next »