|
-
May 13th, 2007, 06:25 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] redirect in PHP?
Hello,
Right now, I can only redirect to another page in PHP using the header ('location: ') command, but it only works if no content was flushed to the browser.
Is there any way to redirect in PHP even with some content already flushed to the browser? Like the Server.Transfer() of ASP.NET.
Thanks,
HoraShadow
I do like the reward system. If you find that my post was useful, rate it.
-
May 13th, 2007, 06:34 PM
#2
Re: redirect in PHP?
Not really - HTTP does not support that.
The best you can achieve is to add in a meta refresh element (but that doesn't work once you're past the head section) or, heaven forbid, a JavaScript redirect. Neither are acceptable solutions.
You should do all processing before outputting anything. That way, you know in advance whether or not you need to redirect, and hence avoid running into this issue at all.
-
May 13th, 2007, 06:50 PM
#3
Thread Starter
Fanatic Member
Re: redirect in PHP?
Thanks for your reply Penagate.
How do I accomplish that?
Thanks,
HoraShadow
I do like the reward system. If you find that my post was useful, rate it.
-
May 13th, 2007, 07:11 PM
#4
Re: redirect in PHP?
Make sure all of your application logic is concluded before beginning output on any page. This usually involves storing various things to variables and then echoing those further on in the HTML (once you've determined whether or not you want to display the page or redirect).
Is there a more specific problem you have?
-
May 13th, 2007, 09:15 PM
#5
Thread Starter
Fanatic Member
Re: redirect in PHP?
Hi Penagate,
I thought it was an option of the php.ini configuration file.
Thanks for the reply.
HoraShadow
I do like the reward system. If you find that my post was useful, rate it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|