开发者

Warning: Cannot modify header information - headers already sent by [closed]

开发者 https://www.devze.com 2023-01-02 21:53 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 开发者_Python百科years ago.
$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. echoing 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消