Im developing some sites using php 4.2 and dreamweaver MX with a mysql database. Now here's the deal. There is a form where a user can submit some information and then on pressing the 'submit' button, the data goes into the database. But on the other page I get this weird error on the top.
If you guys would like a working example of the same, please refer to the url below and submit some information and on doing so, hit the submit button. http://www.i2l2.com/quotes/insert_quotes.phpWarning: Cannot add header information - headers already sent by (output started at C:\Xitami\webpages\quotes\insert_quotes.php:3) in C:\Xitami\webpages\quotes\insert_quotes.php on line 66
On doing so, you will see the error on the top that I am refering about.
Here is the section of the code in question:-
Code: Select all
<?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 tblquotes (quotes_subby, quotes_date, quotes_quote, quotes_author) VALUES (%s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARSї'quotes_subby'], "text"),
GetSQLValueString($HTTP_POST_VARSї'quotes_date'], "text"),
GetSQLValueString($HTTP_POST_VARSї'quotes_quote'], "text"),
GetSQLValueString($HTTP_POST_VARSї'quotes_author'], "text"));
mysql_select_db($database_connQuotes, $connQuotes);
$Result1 = mysql_query($insertSQL, $connQuotes) or die(mysql_error());
$insertGoTo = "view_quotes.php";
if (isset($HTTP_SERVER_VARSї'QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARSї'QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
$date = gmDate("l F d Y");
?>Code: Select all
header(sprintf("Location: %s", $insertGoTo));Please give me some hints and pointers to begin debugging this error.
Thank You.