![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jan 2008
Posts: 3
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
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: PHP Syntax (Toggle Plain Text)
Will throw an error, because it tried to modify the header after all of the headers were sent to the client. PHP Syntax (Toggle Plain Text)
This will work. Because the header is modified, and then output is sent. |
|
|
|
|
|
#3 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 747
Rep Power: 3
![]() |
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>
<?php
header('foo');
?>
__________________
<insert disclaimer here> <insert shameless plug for Visual Studio here> |
|
|
|
|
|
#4 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
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. |
|
|
|
|
|
#5 |
|
Php Coder
|
<?php
ob_start();session_start();
echo "ferdi kucuk";
header("location : url");
?>ob_start(); ![]()
__________________
All in one programming Articles Site |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| solving warning messages, in a program | kalulu | C | 4 | Nov 25th, 2005 8:41 PM |
| Installing IPB 2.03 | bh4575 | Other Web Development Languages | 0 | Apr 23rd, 2005 2:36 AM |
| Warning: The dependency 'mydll' cannot be Warning:The dependency A cannot be copied.. | sarav | C# | 1 | Apr 12th, 2005 7:18 PM |
| TCP Header for Echo Communication | AusTex | C++ | 0 | Feb 27th, 2005 3:57 PM |