Re: redirect issue

From: Date: Mon, 04 Sep 2000 22:32:19 +0000
Subject: Re: redirect issue
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-15182@lists.php.net to get a copy of this message
Zen Rodeo wrote:
A page called present_choices.php sends info from a form to a page called process_choices.php. We want process_choices to send program control either to view_all.php or to insert_form.php, based on the variables sent from present_choices Headers and a redirect can't be used in process_choices since it won't be at the beginning of the file.
header() doesn't have to appear at the beginning of a file, it just needs to occur before any output to the browser. That's an important point to understand. I may have a header() function redirect a user off to an error page, after a hundred lines of code. That's fine, if I didn't echo something already! So, take a look at your code: if you're just doing processing, then figuring out where the user needs to go, there's nothing precluding you from doing just that....just don't echo anything beforehand. +------------------------------------------------+
| Julie Meloni (jcm@i2ii.com)                    |
| Tech. Director, i2i Interactive (www.i2ii.com) |
|                                                |
|      "PHP Essentials" & "PHP Fast & Easy"      |
|            http://www.thickbook.com/           |
+------------------------------------------------+

« previous php.general (#15182) next »