Re: [PHP] Cannot modify header information error........usage of header method.
On Wed, July 20, 2005 10:15 am, babu said: I am using header method to redirect to a certain page.my first question is 1.Is there any other alternative to this method. 2.I am getting the error by using this method. the error is Cannot modify header information - headers already sent by. i have seen the php documentation for header method. where there is one user comment about this. i have followed his steps like removing blank lines, using exit method. But the 3rd point that is HTML goes before any PHP code , i could not follow it , can some one please explain it. Have you ever heard this expression? You can't step in the same river twice What it's saying is that after you have stepped in the river, it's not the same river. The water is moving and flowing and changing at all times. Indeed, the very act of your stepping in the river irrevocably and eternally alters the river, in some infinitesimal way. Now, think about the browser and your server in slow motion The browser asks for URL: XYZ. The server sends out some headers that tell the browser *about* the XYZ content: Content-type: text/html Content-length: ## Expiration: 1/1/2038 After the headers, your server sends a BLANK LINE. Then, your server starts sending out the actual CONTENT: html head titleMy Homepage!/title . . . Now, sessions and Cookies and similar things go IN THE HEADER. If you've *ALREADY* sent the BLANK LINE and started sending CONTENT... IT'S TOO LATE!!! You can't step back in time and send out headers. They already *WENT*. You could just turn on output_buffering in php.ini However, most likely, your program will be a BETTER program if you re-structure it to keep the headers, and any calulations/operations to figure out what the headers should be, at the TOP of your code. Then put in the operations to generate the content. Keeping your headers and content physically separate in your PHP scripts will make your code MUCH more readable and maintainable. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Cannot modify header information error........usage of header method.
babu mailto:[EMAIL PROTECTED] on Wednesday, July 20, 2005 10:15 AM said: 1.Is there any other alternative to this method. Javascript or an html redirect. 2.I am getting the error by using this method. the error is Cannot modify header information - headers already sent by. i have seen the php documentation for header method. where there is one user comment about this. i have followed his steps like removing blank lines, using exit method. You have not removed everything. Output is still being sent to the browser. The error message tells you which file and line is causing the problem. I suggest you go back to it and look closely. But the 3rd point that is HTML goes before any PHP code , i could not follow it , can some one please explain it. I don't follow it either. Seinfeld anyone? Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Cannot modify header information error........usage of header method.
Hi parker, can you please tell me how to use java script or html redirect, i mean a sample. thanks Chris W. Parker [EMAIL PROTECTED] wrote: babu on Wednesday, July 20, 2005 10:15 AM said: 1.Is there any other alternative to this method. Javascript or an html redirect. 2.I am getting the error by using this method. the error is Cannot modify header information - headers already sent by. i have seen the php documentation for header method. where there is one user comment about this. i have followed his steps like removing blank lines, using exit method. You have not removed everything. Output is still being sent to the browser. The error message tells you which file and line is causing the problem. I suggest you go back to it and look closely. But the 3rd point that is HTML goes before any PHP code , i could not follow it , can some one please explain it. I don't follow it either. Seinfeld anyone? Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with voicemail
Re: [PHP] Cannot modify header information error........usage of header method.
babu wrote: Hi parker, can you please tell me how to use java script or html redirect, i mean a sample. thanks Chris W. Parker [EMAIL PROTECTED] wrote: babu on Wednesday, July 20, 2005 10:15 AM said: 1.Is there any other alternative to this method. Javascript or an html redirect. 2.I am getting the error by using this method. the error is Cannot modify header information - headers already sent by. i have seen the php documentation for header method. where there is one user comment about this. i have followed his steps like removing blank lines, using exit method. You have not removed everything. Output is still being sent to the browser. The error message tells you which file and line is causing the problem. I suggest you go back to it and look closely. But the 3rd point that is HTML goes before any PHP code , i could not follow it , can some one please explain it. I don't follow it either. Seinfeld anyone? Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with voicemail Javascript: document.location = new_url.html; HTML: meta http-equiv=refresh content=1,http://site.com/new_page.html; HTH, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Cannot modify header information error........usage of header method.
babu mailto:[EMAIL PROTECTED] on Wednesday, July 20, 2005 10:33 AM said: Hi parker, can you please tell me how to use java script or html redirect, i mean a sample. I must be in a good mood today. :) html redirect (more accurately called meta refresh): http://www.pageresource.com/html/metref.htm Javascript: http://www.pageresource.com/html/metref.htm Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot modify header information error........usage of header method.
Thanks for the help mike and parker, I have used ob_start and ob_end_flush methods, and its working fine. i got good idea of redirecting now. Mikey [EMAIL PROTECTED] wrote: babu wrote: Hi parker, can you please tell me how to use java script or html redirect, i mean a sample. thanks Chris W. Parker wrote: babu on Wednesday, July 20, 2005 10:15 AM said: 1.Is there any other alternative to this method. Javascript or an html redirect. 2.I am getting the error by using this method. the error is Cannot modify header information - headers already sent by. i have seen the php documentation for header method. where there is one user comment about this. i have followed his steps like removing blank lines, using exit method. You have not removed everything. Output is still being sent to the browser. The error message tells you which file and line is causing the problem. I suggest you go back to it and look closely. But the 3rd point that is HTML goes before any PHP code , i could not follow it , can some one please explain it. I don't follow it either. Seinfeld anyone? Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with voicemail Javascript: document.location = new_url.html; HTML: HTH, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with voicemail