2010-06-05 120 views
-2
$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); 
+0

转推[这里](http://stackoverflow.com/questions/2979341/warning-cannot-modify-header-information-headers-already-sent-by)。 @mohanraj如果您需要添加详细信息,您可以[编辑问题](http://stackoverflow.com/posts/2979256/edit) – 2010-06-05 06:00:55

+1

您有问题吗? – 2010-06-05 08:23:08

回答

1

您的问题似乎不在这段代码中;如果您在调用header()函数之前向用户发送了任何内容,则会发生这种情况。您需要确保不向客户端发送任何数据(例如echo),因为这会导致标题被发送,这意味着它们不能被修改。

2

防止任何输出中断方法头的简单方法之一是在页面的开始处使用缓冲。

例:

<?php 
ob_start(); // Start buffering // 

echo "Some echo"; 
header('Location: thiswillwork.php'); 
?> 
0

确保你没有你的PHP代码之前,有白色的空间。

相关问题