显示错误:
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\jiajia\add.php:1) in C:\xampp\htdocs\jiajia\add.php on line 52代码如下:
<?php virtual('/jiajia/Connections/conn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
} $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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 = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO xw (bt, nr) VALUES (%s, %s)",
GetSQLValueString($_POST['bt'], "text"),
GetSQLValueString($_POST['nr'], "text")); mysql_select_db($database_conn, $conn);
$Result1 = mysql_query($insertSQL, $conn) or die(mysql_error()); $insertGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
.tj {
font-size: 24px;
}
-->
</style>
</head><body>
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<p> <span class="tj">添加页面</span></p>
<p> </p>
<p>标题:
<input type="text" name="bt" id="bt" />
</p>
<p>内容:
<input type="text" name="nr" id="nr" />
</p>
<p>
<input type="submit" name="submit" id="submit" value="添加" />
</p>
<p> </p>
<p> </p>
<input type="hidden" name="MM_insert" value="form1" />
</form>
</body>
</html>
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\jiajia\add.php:1) in C:\xampp\htdocs\jiajia\add.php on line 52代码如下:
<?php virtual('/jiajia/Connections/conn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
} $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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 = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO xw (bt, nr) VALUES (%s, %s)",
GetSQLValueString($_POST['bt'], "text"),
GetSQLValueString($_POST['nr'], "text")); mysql_select_db($database_conn, $conn);
$Result1 = mysql_query($insertSQL, $conn) or die(mysql_error()); $insertGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
.tj {
font-size: 24px;
}
-->
</style>
</head><body>
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<p> <span class="tj">添加页面</span></p>
<p> </p>
<p>标题:
<input type="text" name="bt" id="bt" />
</p>
<p>内容:
<input type="text" name="nr" id="nr" />
</p>
<p>
<input type="submit" name="submit" id="submit" value="添加" />
</p>
<p> </p>
<p> </p>
<input type="hidden" name="MM_insert" value="form1" />
</form>
</body>
</html>
我要给你YES。
你的答案很满意我的胃口。