RE: [PHP] Redirect upon execution of script...
| From: | Daniel Alsén | Date: | Sun, 25 Nov 2001 17:24:31 +0000 |
| Subject: | RE: [PHP] Redirect upon execution of script... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75655@lists.php.net to get a copy of this message | ||
> 2. User fills in a form, clicks "submit" which calls the same script,
> passing itself the values. Depending on the value passed by the submit
> button, the script processes the information (INSERT or UPDATE) and sets
> $done = 1 if successful.
>
> The second scenario is easier to handle.
> Call the same script, passing it $done, and depending on whether or not
> $done is set you redirect.
>
> Juli Meloni has done an excellent tutorial on just this at
> http://www.thickbook.com. look in the tutorials for something
> like "Form
> With Error Message". You just have to adapt the logic to suit your needs.
The second scenario is correct. I am actually already using the method in
Melonis tutorial for error messages. But i can´t do a redirection that way
since $done isn´t set until after the db INSERT. My if-statement for the
header is at the top of the page (wich is the only place i can put it) and
will never know if $done is set or not below.
- Daniel