Something like that... The way my site is set up all the content is "wrapped" by the index.php script. So no matter what page your looking at your browser is still pointed to the same index.php. At times I have pages that have includes that are five and six pages deep.
The form and validation that does the re-direct could easily be in a page that's included from another page that's included in index.php and it would be re-directing you back to index.php with other parameters. Making it so that there was no output before the header() call wasn't something I was planning for as I developed it so going back and making it that way isn't a high priority for me when I have a simple JavaScript solution. Browsers with JavaScript turned off isn't a concern because the splash page of the site requires it and all the people using the site require JavaScript for other internal systems here. Maybe at some point I'll rewrite it so the re-direction can be server side but for now it's serving my purposes. j- Jack Kelly Dobson Systems Administrator Charlton [EMAIL PROTECTED] > -----Original Message----- > From: Rich Gray [mailto:[EMAIL PROTECTED]] > Sent: Thursday, November 28, 2002 3:55 AM > To: Jack Kelly Dobson; [EMAIL PROTECTED] > Subject: RE: [PHP-WIN] Redirect browser to another URL? > > > Jack > > Sorry - I am a bit confused... Are you saying you could not get a header() > re-direct to work in a script that posts form data to itself? As someone > else has mentioned the header() call does not have to be at the top of the > script it just has to be executed before any output has gone to the > browser...it could be the last line of a script. > > BTW your javascript solution won't work if the user has switched off > javascript... > > Rich > -----Original Message----- > From: Jack Kelly Dobson [mailto:[EMAIL PROTECTED]] > Sent: 27 November 2002 16:20 > To: [EMAIL PROTECTED] > Subject: Re: [PHP-WIN] Redirect browser to another URL? > > > Thanks for all the help guys. > > My problem, as most of you figured, is that my script has a form > in it that > re-runs itself when the form is submitted so there is only one script > including the form and all the validation for the form. If the > validation is > successful it sends you to a different page depending on the information > posted in the form. There was therefore no way I could get the header() to > be at the top of the returned data. > > I ended up using: > > if ($condition) { > print("<SCRIPT LANGUAGE='JavaScript'>window.location='" . $url . > "'</SCRIPT>"); > } > > A rather elegant solution I've decided. > > Oh, and FYI to all you IIS users out there... (At least I'm assuming it's > IIS and not the Windows platform itself. I'd be interested to know what > Windows users running Apache are experiencing). > > I didn't have this problem with my script until I migrated it to a > Linux/Apache platform. > > I assume that means that when I was doing it the original way that I had > multiple sets of header information and no telling what else > being sent back > to the browser and IIS wasn't producing any error. Anyone using > IIS and the > header(location: '') function might want to make sure they aren't exposing > data they didn't mean to. > > j- > > "Cam Dunstan" <[EMAIL PROTECTED]> wrote in message > 002801c29602$d3e50da0$7866a8c0@camhome">news:002801c29602$d3e50da0$7866a8c0@camhome... > > Jack, > > here is another quick and dirty function to stick in your library, yet > > another way to redirect from anywhere in your script > > > > function redirect($url){ > > echo "<script>window.location.replace(\"".$url."\")</script>"; > > } > > > > usage: > > > > blah > > blah > > redirect("any_url"); > > > > exit; > > > > > > > > > > > > -----Original Message----- > > > From: Jack Kelly Dobson [mailto:[EMAIL PROTECTED]] > > > Sent: Tuesday, November 26, 2002 2:43 PM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP-WIN] Redirect browser to another URL? > > > > > > > > > Hello, > > > > > > Anyone know how to have a script re-direct the browser to a > URL cleanly? > > > > > > > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php