Advanced Minds

  • Decrease font size
  • Default font size
  • Increase font size
  • default color
  • red color
  • green color
FireBoard
Welcome, Guest
Please Login or Register.    Lost Password?
php redirect php header redirect - does it have to be the very first thing in the file? (1 viewing) (1) Guests
Go to bottom Post Reply Favoured: 0
TOPIC: php redirect php header redirect - does it have to be the very first thing in the file?
#2393
php redirect php header redirect - does it have to be the very first thing in the file?  
I was told that a php redirect: <? header ( Location: http://www.whatever.com ); exit; ? had to be the first piece of code in a php template to work.  This seems kind of useless if I can't put it in an IF statement to redirect the user only if a certain criteria is met, or after some other logic is run. Is this a limitation of the php header redirect?? thanks - dan
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#2394
Morten Nilsen (Visitor)
Click here to see the profile of this user
Birthdate:
php redirect php header redirect - does it have to be the very first thing in the file?  
I was told that a php redirect: <? header ( Location: http://www.whatever.com ); exit; ? had to be the first piece of code in a php template to work.  This seems kind of useless if I can't put it in an IF statement to redirect the user only if a certain criteria is met, or after some other logic is run. Is this a limitation of the php header redirect?? thanks - dan it has to be set before the headers are sent, ie. any output is made. or you can enable output buffer, and it will work any time... (refer to the php manual for details)
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#2395
Bob (Visitor)
Click here to see the profile of this user
Birthdate:
php redirect php header redirect - does it have to be the very first thing in the file?  
I was told that a php redirect: <? header ( Location: http://www.whatever.com ); exit; ? had to be the first piece of code in a php template to work.  This seems kind of useless if I can't put it in an IF statement to redirect the user only if a certain criteria is met, or after some other logic is run. Is this a limitation of the php header redirect?? You can't output data (even blank lines) before you send header data. Bob @  www.PlugSocket.com
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#2396
Jack (Visitor)
Click here to see the profile of this user
Birthdate:
php redirect php header redirect - does it have to be the very first thing in the file?  
Where
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#2397
Dave (Visitor)
Click here to see the profile of this user
Birthdate:
php redirect php header redirect - does it have to be the very first thing in the file?  
Or you can turn on output buffering, then they work whatever you do. <? ob_start(); echo This is some output ; header( location: http://www.yo-mommas-house.com ); ? will still work. Dave Jack < This e-mail address is being protected from spam bots, you need JavaScript enabled to view it wrote in message - Hide quoted text -- Show quoted text - Where
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#2398
ocb23 (Visitor)
Click here to see the profile of this user
Birthdate:
php redirect php header redirect - does it have to be the very first thing in the file?  
I was told that a php redirect: <? header ( Location: http://www.whatever.com ); exit; ? had to be the first piece of code in a php template to work.  This seems kind of useless if I can't put it in an IF statement to redirect the user only if a certain criteria is met, or after some other logic is run. Is this a limitation of the php header redirect?? thanks - dan you can do as many php operations as you want, before sending a header redirect. but after you have some output (html, blanks, whatever) you cant do a header redirect.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop
sprawdz autoryzacje brak autoryzacji 905 brak autoryzacji wymiana linkow
porsche china holidays abc local news news 12 trade news