![]() |
Warning: Cannot modify header information - headers already sent by (output started at
I am looking for my contact form when submitting, to redirect to a 'thank you' page, however I receive the following error.
Warning: Cannot modify header information - headers already sent by (output started at I am new to php programming; clear instructions or language is appreciated. Thanks. |
Re: Warning: Cannot modify header information - headers already sent by (output started at
The function, "header", can not be called if you've already made the script output text to the client.
For example: :
Will throw an error, because it tried to modify the header after all of the headers were sent to the client. :
This will work. Because the header is modified, and then output is sent. |
Re: Warning: Cannot modify header information - headers already sent by (output started at
Also of note, the PHP code must be the first thing in the file. The following will not work:
:
<!DOCTYPE blah blah blah> |
Re: Warning: Cannot modify header information - headers already sent by (output started at
If you still want to supress the error, you can do so by calling the error_reporting function. Or, if you want to do it for all files, edit the php.ini file - check the line beginning with "error_reporting = ".
If this is your production server, turning display_errors off and log_errors on in your php.ini file is recommended, so if there are any errors, your users don't see them but you do. If it's your development server, I'd recommend the opposite - set error_reporting to E_ALL, display_errors to On and log_errors to Off. |
Re: Warning: Cannot modify header information - headers already sent by (output started at
:
<?php ob_start(); ;) |
| All times are GMT -5. The time now is 9:50 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC