[PHP] PHP Header issue
html head titleContact Us/title /head body ?php header(Location: advertise2.php); ? /body /html The above is just snippet of the code but even this simple example throws the Header Warning / Error. Warning: Cannot modify header information - headers already sent by (output started at /home/content/g/t/a /html/yourestate/advertise.php:6) in/home/content/g/t/a /html/yourestate/advertise.php on line 6 The anwser may be simple but I have looked a blanks or spaces around the ?php ? with no success. Ready need your help. Thanks, Ernie Kemp Phone: 416 577 5565 Email: ek...@digitalbiz4u.com ...man will occasionally stumble over the truth, but usually manages to pick himself up, walk over or around it, and carry on. Winston S. Churchill
Re: [PHP] PHP Header issue
On Fri, Sep 18, 2009 at 12:39 PM, Ernie Kemp ernie.k...@sympatico.ca wrote: html head titleContact Us/title /head body ?php header(Location: advertise2.php); ? /body /html The above is just snippet of the code but even this simple example throws the Header Warning / Error. Warning: Cannot modify header information - headers already sent by (output started at /home/content/g/t/a /html/yourestate/advertise.php:6) in/home/content/g/t/a /html/yourestate/advertise.php on line 6 The anwser may be simple but I have looked a blanks or spaces around the ?php ? with no success. Ready need your help. Thanks, Ernie Kemp Phone: 416 577 5565 Email: ek...@digitalbiz4u.com It's all that HTML above and before ?php header(Location: advertise2.php); ? You can't send ANY content to the client before sending headers. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Header issue
Ernie Kemp wrote: html head titleContact Us/title /head body ?php header(Location: advertise2.php); ? /body /html The above is just snippet of the code but even this simple example throws the Header Warning / Error. Warning: Cannot modify header information - headers already sent by (output started at /home/content/g/t/a /html/yourestate/advertise.php:6) in/home/content/g/t/a /html/yourestate/advertise.php on line 6 http://us2.php.net/manual/en/function.header.php From the manual page: Quote: Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file. The anwser may be simple but I have looked a blanks or spaces around the ?php ? with no success. Ready need your help. Thanks, Ernie Kemp Phone: 416 577 5565 Email: ek...@digitalbiz4u.com ...man will occasionally stumble over the truth, but usually manages to pick himself up, walk over or around it, and carry on. Isn't that the truth! Winston S. Churchill -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Header issue
http://us3.php.net/manual/en/function.header.php Thank you, Marc Hall HallMarc Websites 610.446.3346 __ Information from ESET Smart Security, version of virus signature database 4438 (20090918) __ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Header issue
Thanks for your reply Andrew. I think you can add the Header in your body. The code working on my local system. Thanks, .../Ernie -Original Message- From: Andrew Ballard [mailto:aball...@gmail.com] Sent: September-18-09 12:44 PM To: Ernie Kemp Cc: php-general@lists.php.net Subject: Re: [PHP] PHP Header issue On Fri, Sep 18, 2009 at 12:39 PM, Ernie Kemp ernie.k...@sympatico.ca wrote: html head titleContact Us/title /head body ?php header(Location: advertise2.php); ? /body /html The above is just snippet of the code but even this simple example throws the Header Warning / Error. Warning: Cannot modify header information - headers already sent by (output started at /home/content/g/t/a /html/yourestate/advertise.php:6) in/home/content/g/t/a /html/yourestate/advertise.php on line 6 The anwser may be simple but I have looked at blanks or spaces around the ?php ? with no success. Ready need your help. Thanks, Ernie Kemp Phone: 416 577 5565 Email: ek...@digitalbiz4u.com It's all that HTML above and before ?php header(Location: advertise2.php); ? You can't send ANY content to the client before sending headers. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Header issue
I'm bewildered, bemused, astonished and am trying really hard not to lash out Thank you, Marc Hall HallMarc Websites 610.446.3346 __ Information from ESET Smart Security, version of virus signature database 4438 (20090918) __ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Header issue
On Fri, 2009-09-18 at 13:12 -0400, Ernie Kemp wrote: Thanks for your reply Andrew. I think you can add the Header in your body. The code working on my local system. Thanks, .../Ernie -Original Message- From: Andrew Ballard [mailto:aball...@gmail.com] Sent: September-18-09 12:44 PM To: Ernie Kemp Cc: php-general@lists.php.net Subject: Re: [PHP] PHP Header issue On Fri, Sep 18, 2009 at 12:39 PM, Ernie Kemp ernie.k...@sympatico.ca wrote: html head titleContact Us/title /head body ?php header(Location: advertise2.php); ? /body /html The above is just snippet of the code but even this simple example throws the Header Warning / Error. Warning: Cannot modify header information - headers already sent by (output started at /home/content/g/t/a /html/yourestate/advertise.php:6) in/home/content/g/t/a /html/yourestate/advertise.php on line 6 The anwser may be simple but I have looked at blanks or spaces around the ?php ? with no success. Ready need your help. Thanks, Ernie Kemp Phone: 416 577 5565 Email: ek...@digitalbiz4u.com It's all that HTML above and before ?php header(Location: advertise2.php); ? You can't send ANY content to the client before sending headers. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You really can't add the header() where you have it. It must come before *any* output sent to the browser. This includes any single character, either if it's part of a tag, a word or even a single space or line break. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Header issue
Jim Lucas wrote: Ernie Kemp wrote: html head titleContact Us/title /head body ?php header(Location: advertise2.php); ? /body /html The above is just snippet of the code but even this simple example throws the Header Warning / Error. Warning: Cannot modify header information - headers already sent by (output started at /home/content/g/t/a /html/yourestate/advertise.php:6) in/home/content/g/t/a /html/yourestate/advertise.php on line 6 http://us2.php.net/manual/en/function.header.php From the manual page: Quote: Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file. The anwser may be simple but I have looked a blanks or spaces around the ?php ? with no success. Ready need your help. Thanks, Ernie Kemp Phone: 416 577 5565 Email: ek...@digitalbiz4u.com ...man will occasionally stumble over the truth, but usually manages to pick himself up, walk over or around it, and carry on. Isn't that the truth! Winston S. Churchill Just to point out to everybody, you can actually do this. And most of you probably already know how. You can use output buffering. :) if you use ob_start() anywhere in your code before this statement, or you have output_buffering option enabled in the php configuration. Now, with that said, using output buffering to fix this problem is the wrong solution. But it does work. Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Header issue
if ... you have output_buffering option enabled in the php configuration. Which is probably the case on the OP's local machine, and would explain why the code doesn't fail for him there. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Header issue
I think you may have something there Ben. This code is in my php.ini file. This was 'on' by default. ; Output buffering allows you to send header lines (including cookies) even ; after you send body content, at the price of slowing PHP's output layer a ; bit. You can enable output buffering during runtime by calling the output ; buffering functions. You can also enable output buffering for all files by ; setting this directive to On. If you wish to limit the size of the buffer ; to a certain size - you can use a maximum number of bytes instead of 'On', as ; a value for this directive (e.g., output_buffering=4096). output_buffering = On I will comment it out and try on my local system again. Thanks, /Ernie +++= -Original Message- From: Ben Dunlap [mailto:bdun...@agentintellect.com] Sent: September-18-09 1:41 PM To: Jim Lucas Cc: Ernie Kemp; php-general@lists.php.net Subject: Re: [PHP] PHP Header issue if ... you have output_buffering option enabled in the php configuration. Which is probably the case on the OP's local machine, and would explain why the code doesn't fail for him there. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Header issue
-Original Message- From: Jim Lucas [mailto:li...@cmsws.com] Sent: Friday, September 18, 2009 1:33 PM To: Ernie Kemp Cc: php-general@lists.php.net Subject: Re: [PHP] PHP Header issue Jim Lucas wrote: Ernie Kemp wrote: html head titleContact Us/title /head body ?php header(Location: advertise2.php); ? /body /html The above is just snippet of the code but even this simple example throws the Header Warning / Error. Warning: Cannot modify header information - headers already sent by (output started at /home/content/g/t/a /html/yourestate/advertise.php:6) in/home/content/g/t/a /html/yourestate/advertise.php on line 6 http://us2.php.net/manual/en/function.header.php From the manual page: Quote: Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file. The anwser may be simple but I have looked a blanks or spaces around the ?php ? with no success. Ready need your help. Thanks, Ernie Kemp Phone: 416 577 5565 Email: ek...@digitalbiz4u.com ...man will occasionally stumble over the truth, but usually manages to pick himself up, walk over or around it, and carry on. Isn't that the truth! Winston S. Churchill Just to point out to everybody, you can actually do this. And most of you probably already know how. You can use output buffering. :) if you use ob_start() anywhere in your code before this statement, or you have output_buffering option enabled in the php configuration. Now, with that said, using output buffering to fix this problem is the wrong solution. But it does work. Jim I thought of that too and I ran a test on my server just to make sure - guess what? it doesn't work either and I am assuming that is because I have it turned off in my php.ini I prefer not to use the ob because I do a lot of development on my server and don't want to wonder if a PHP error got lost in the buffer because the PHP error handling nixed the script before the error was sent to the screen. The question I have is do you need this redirect to sit where it is? It would be so much easier to just write this page correctly. Thank you, Marc Hall HallMarc Websites 610.446.3346 __ Information from ESET Smart Security, version of virus signature database 4438 (20090918) __ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Header issue
The fundamental idea was to fill in a contact forum , submit it and then go to an upload page. I need to go from one page to another page. Please point in the correct direction on this. Thanks, /Ernie +++ -Original Message- From: HallMarc Websites [mailto:m...@hallmarcwebsites.com] Sent: September-18-09 2:00 PM To: 'Jim Lucas'; 'Ernie Kemp' Cc: php-general@lists.php.net Subject: RE: [PHP] PHP Header issue -Original Message- From: Jim Lucas [mailto:li...@cmsws.com] Sent: Friday, September 18, 2009 1:33 PM To: Ernie Kemp Cc: php-general@lists.php.net Subject: Re: [PHP] PHP Header issue Jim Lucas wrote: Ernie Kemp wrote: html head titleContact Us/title /head body ?php header(Location: advertise2.php); ? /body /html The above is just snippet of the code but even this simple example throws the Header Warning / Error. Warning: Cannot modify header information - headers already sent by (output started at /home/content/g/t/a /html/yourestate/advertise.php:6) in/home/content/g/t/a /html/yourestate/advertise.php on line 6 http://us2.php.net/manual/en/function.header.php From the manual page: Quote: Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file. The anwser may be simple but I have looked a blanks or spaces around the ?php ? with no success. Ready need your help. Thanks, Ernie Kemp Phone: 416 577 5565 Email: ek...@digitalbiz4u.com ...man will occasionally stumble over the truth, but usually manages to pick himself up, walk over or around it, and carry on. Isn't that the truth! Winston S. Churchill Just to point out to everybody, you can actually do this. And most of you probably already know how. You can use output buffering. :) if you use ob_start() anywhere in your code before this statement, or you have output_buffering option enabled in the php configuration. Now, with that said, using output buffering to fix this problem is the wrong solution. But it does work. Jim I thought of that too and I ran a test on my server just to make sure - guess what? it doesn't work either and I am assuming that is because I have it turned off in my php.ini I prefer not to use the ob because I do a lot of development on my server and don't want to wonder if a PHP error got lost in the buffer because the PHP error handling nixed the script before the error was sent to the screen. The question I have is do you need this redirect to sit where it is? It would be so much easier to just write this page correctly. Thank you, Marc Hall HallMarc Websites 610.446.3346 __ Information from ESET Smart Security, version of virus signature database 4438 (20090918) __ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Header issue
On Fri, 2009-09-18 at 14:26 -0400, Ernie Kemp wrote: The fundamental idea was to fill in a contact forum , submit it and then go to an upload page. I need to go from one page to another page. Please point in the correct direction on this. Thanks, /Ernie +++ -Original Message- From: HallMarc Websites [mailto:m...@hallmarcwebsites.com] Sent: September-18-09 2:00 PM To: 'Jim Lucas'; 'Ernie Kemp' Cc: php-general@lists.php.net Subject: RE: [PHP] PHP Header issue -Original Message- From: Jim Lucas [mailto:li...@cmsws.com] Sent: Friday, September 18, 2009 1:33 PM To: Ernie Kemp Cc: php-general@lists.php.net Subject: Re: [PHP] PHP Header issue Jim Lucas wrote: Ernie Kemp wrote: html head titleContact Us/title /head body ?php header(Location: advertise2.php); ? /body /html The above is just snippet of the code but even this simple example throws the Header Warning / Error. Warning: Cannot modify header information - headers already sent by (output started at /home/content/g/t/a /html/yourestate/advertise.php:6) in/home/content/g/t/a /html/yourestate/advertise.php on line 6 http://us2.php.net/manual/en/function.header.php From the manual page: Quote: Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file. The anwser may be simple but I have looked a blanks or spaces around the ?php ? with no success. Ready need your help. Thanks, Ernie Kemp Phone: 416 577 5565 Email: ek...@digitalbiz4u.com ...man will occasionally stumble over the truth, but usually manages to pick himself up, walk over or around it, and carry on. Isn't that the truth! Winston S. Churchill Just to point out to everybody, you can actually do this. And most of you probably already know how. You can use output buffering. :) if you use ob_start() anywhere in your code before this statement, or you have output_buffering option enabled in the php configuration. Now, with that said, using output buffering to fix this problem is the wrong solution. But it does work. Jim I thought of that too and I ran a test on my server just to make sure - guess what? it doesn't work either and I am assuming that is because I have it turned off in my php.ini I prefer not to use the ob because I do a lot of development on my server and don't want to wonder if a PHP error got lost in the buffer because the PHP error handling nixed the script before the error was sent to the screen. The question I have is do you need this redirect to sit where it is? It would be so much easier to just write this page correctly. Thank you, Marc Hall HallMarc Websites 610.446.3346 __ Information from ESET Smart Security, version of virus signature database 4438 (20090918) __ The message was checked by ESET Smart Security. http://www.eset.com Well, set the action of the form to the upload script. Then, in your upload script, check to see that all the fields are as required, and either upload the file from the form, or send them back to the form. I'd tend to have all the logic on the same PHP file, just for neatness. Thanks, Ash http://www.ashleysheridan.co.uk
RE: [PHP] PHP Header issue
-Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Friday, September 18, 2009 2:31 PM To: Ernie Kemp Cc: 'HallMarc Websites'; 'Jim Lucas'; php-general@lists.php.net Subject: RE: [PHP] PHP Header issue On Fri, 2009-09-18 at 14:26 -0400, Ernie Kemp wrote: The fundamental idea was to fill in a contact forum , submit it and then go to an upload page. I need to go from one page to another page. Please point in the correct direction on this. Thanks, /Ernie +++ -Original Message- From: HallMarc Websites [mailto:m...@hallmarcwebsites.com] Sent: September-18-09 2:00 PM To: 'Jim Lucas'; 'Ernie Kemp' Cc: php-general@lists.php.net Subject: RE: [PHP] PHP Header issue -Original Message- From: Jim Lucas [mailto:li...@cmsws.com] Sent: Friday, September 18, 2009 1:33 PM To: Ernie Kemp Cc: php-general@lists.php.net Subject: Re: [PHP] PHP Header issue Jim Lucas wrote: Ernie Kemp wrote: html head titleContact Us/title /head body ?php header(Location: advertise2.php); ? /body /html The above is just snippet of the code but even this simple example throws the Header Warning / Error. Warning: Cannot modify header information - headers already sent by (output started at /home/content/g/t/a /html/yourestate/advertise.php:6) in/home/content/g/t/a /html/yourestate/advertise.php on line 6 http://us2.php.net/manual/en/function.header.php From the manual page: Quote: Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file. The anwser may be simple but I have looked a blanks or spaces around the ?php ? with no success. Ready need your help. Thanks, Ernie Kemp Phone: 416 577 5565 Email: ek...@digitalbiz4u.com ...man will occasionally stumble over the truth, but usually manages to pick himself up, walk over or around it, and carry on. Isn't that the truth! Winston S. Churchill Just to point out to everybody, you can actually do this. And most of you probably already know how. You can use output buffering. :) if you use ob_start() anywhere in your code before this statement, or you have output_buffering option enabled in the php configuration. Now, with that said, using output buffering to fix this problem is the wrong solution. But it does work. Jim I thought of that too and I ran a test on my server just to make sure - guess what? it doesn't work either and I am assuming that is because I have it turned off in my php.ini I prefer not to use the ob because I do a lot of development on my server and don't want to wonder if a PHP error got lost in the buffer because the PHP error handling nixed the script before the error was sent to the screen. The question I have is do you need this redirect to sit where it is? It would be so much easier to just write this page correctly. Thank you, Marc Hall HallMarc Websites 610.446.3346 __ Information from ESET Smart Security, version of virus signature database 4438 (20090918) __ The message was checked by ESET Smart Security. http://www.eset.com Well, set the action of the form to the upload script. Then, in your upload script, check to see that all the fields are as required, and either upload the file from the form, or send them back to the form. I'd tend to have all the logic on the same PHP file, just for neatness. Thanks, Ash http://www.ashleysheridan.co.uk You should be validating/cleansing the form input as a matter of SOP anyway. *opens a fresh can of worms* __ Information from ESET Smart Security, version of virus signature database 4438 (20090918) __ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Header issue
Your code does not make sense (to me anyway). It flags an error because you are sending HTML before the header command. Don't bother looking for whitespace etc...the htmlheadtitle etc is more than enough to produce this error. Using Location redirects to another URL. It does not make sense to redirect in the middle of a page. I think instead of header, you meant to use include or require (same thing.) Is your intention to include the file advertise2.php in the body section? If so, get rid of the header line, and use this : ?php include(..path..to../advertise2.php); ? Good luck with it! - Original Message - From: Ernie Kemp To: php-general@lists.php.net Sent: Saturday, September 19, 2009 2:39 AM Subject: [PHP] PHP Header issue html head titleContact Us/title /head body ?php header(Location: advertise2.php); ? /body /html The above is just snippet of the code but even this simple example throws the Header Warning / Error. Warning: Cannot modify header information - headers already sent by (output started at /home/content/g/t/a /html/yourestate/advertise.php:6) in/home/content/g/t/a /html/yourestate/advertise.php on line 6 The anwser may be simple but I have looked a blanks or spaces around the ?php ? with no success. Ready need your help. Thanks, Ernie Kemp Phone: 416 577 5565 Email: ek...@digitalbiz4u.com ...man will occasionally stumble over the truth, but usually manages to pick himself up, walk over or around it, and carry on. Winston S. Churchill