headers already sent error message
Posted: Fri Dec 06, 2002 2:11 pm
I get this error message:
the second to last line is the line 47. with the header() function. I can't figure out what is wrong, if you can help I'd greatly appreciate it!
I am fairly sure I can figure out is wrong I just need to know what this error message means exactly. Here's the code around line 47, and I see nothing wrong with it:Warning: Cannot add header information - headers already sent by (output started at /home/ttoomey/youngdental.com/siteadmin/insert.php:2) in /home/ttoomey/youngdental.com/siteadmin/insert.php on line 47
Code: Select all
<?php require_once('../Connections/cConnect.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $HTTP_SERVER_VARSї'PHP_SELF'];
if (isset($HTTP_SERVER_VARSї'QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARSї'QUERY_STRING'];
}
if ((isset($HTTP_POST_VARSї"MM_insert"])) && ($HTTP_POST_VARSї"MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO page (pname, pcontent, ptitle) VALUES (%s, %s, %s)",
GetSQLValueString($HTTP_POST_VARSї'pname'], "text"),
GetSQLValueString($HTTP_POST_VARSї'pcontent'], "text"),
GetSQLValueString($HTTP_POST_VARSї'ptitle'], "text"));
mysql_select_db($database_cConnect, $cConnect);
$Result1 = mysql_query($insertSQL, $cConnect) or die(mysql_error());
$insertGoTo = "http://www.youngdental.com/siteadmin/admin.php";
if (isset($HTTP_SERVER_VARSї'QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARSї'QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>