Just for feedback (note: I don't run Apache on win32 live anywhere - it's
primarily a test bed), Apache has worked flawless for me. However, I tend to
put Apache on Linux when I get the chance. Stability of NT still scares me.

I like using Apache for a few reasons:
1. It's cleaner (simple text config file)
2. It's smaller (takes up less resources)
3. Apache seems to be more compliant (expect MS to be compliant with any
spec other than their own?)

But one of the biggest reasons is this: I have almost never had to use PHP
on a windows server (only once, and that was on IIS3 which was eventually
migrated to Apache). I'm comfy with Apache so I stick with it. I have the
unfortunate task of managing a few IIS servers which run proprietary
software which I cannot switch to Apache.

By the way, the header() call does not need to be at the top of the page -
just before any output has been sent to the browser. I have header calls
90-100 lines down simply because it's part of an else statement (like if
blah { /*lines 2-100*/ } else { header (location: blah.php);}). Just make
sure no output of any kind was sent before the header call (except session
stuff or other header calls).

-Dash

-----Original Message-----
From: Jack Kelly Dobson [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, November 27, 2002 8:20 AM
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

Reply via email to