cannot modify header.
I've build a contact form and it works, but I can't get the thankyou message to appear. I keep getting the following error message which I don't understand as I can see anything wrong with line 46. Any suggestions...I'm new!
Warning: Cannot modify header information - headers already sent by (output started at /home/content/24/10758824/html/contact.php:2) in /home/content/24/10758824/html/contact.php on line 46
Post the script. Most of the time, this error is generated by a redirect or die when you already echoed something to output.
if you using any sort of redirect on that page then you should put ob_start(); in the top of the page and ob_flush(); in the bottom, it should fix the problem for you.
Dont use any thing regarding this problem
This Problems Begins when Some output being starts before the header(location : 'http://www.somewebste.com');
you can simple use the <script>window.location.href="http://www.somewebste.com"</script> ;
In Place of this It works like a charm try this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="images/favicon.gif"/>
<link rel="shortcut icon" href="images/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="<?php echo SITE_STYLE; ?>"/>
<div id="page_effect" style="display:none;">
<?php require_once('./controls/login/login.control.php'); ?>
// redirect to destination
if($user_redirect != 'default')
elseif($user_redirect == 'default' && isset($_GET['ReturnURL']))
$destination_url = $_GET['ReturnURL'];
This error is caused because something is being displayed before line 46 has been called. Remove any HTML, text or white space before this line. The header must be before anything is sent/output to the browser.
Originally Posted by noahwilson
The code above will fail. Notice that HTML code is output BEFORE the PHP header() function. That is invalid.
Originally Posted by gaurav.insight