Warning: Cannot modify header information - headers already sent by [closed]
$sql="insert into digifresh_review values('0','$created','$modified','$cus_name','$cus_email','$cus_description','$type')";
if (mysql_query($sql,$con))
{
header("location: ../digifresh/thankyou.php");
}
else
{
die('Error: ' . mysql_error());
}
mysql_close($con);
One of the easy way to prevent any output to disrupt the method header is to use buffering at the beginning of the page.
Ex.:
<?php
ob_start(); // Start buffering //
echo "Some echo";
header('Location: thiswillwork.php');
?>
Your issue doesn't appear to be in this snippet of code; this happens if you've sent anything to the user before calling the header()
function. You need to make sure you don't send any data to the client (e.g. echo
ing something), as that will cause the headers to be sent, which means they can't be modified.
Make sure you don't have white-spaces before your php code.
精彩评论