我不想把同一形式的信息转过来。 然而,使用<代码>标题(地点:来宾书.php);给我一个错误:
警告:不能修改主人的信息——已经由(投稿开始在试验/编目中)寄出的头盔人员。 php on line 29
我不敢肯定,如果我把头盔放在适当的位置,我不十分熟悉使用:
<?php
$gb_str = ""; // $gb_str is the string we ll append entries to
$pgeTitle = "View and Sign Guestbook";
// If form is submitted, then insert into DB
if (!empty($HTTP_POST_VARS["submit"])) {
// initiate some vars
$dbHost = ;
$dbUser = ;
$dbPass = ;
$dbDatabase = ;
$li = mysql_connect($dbHost, $dbUser, $dbPass) or die("Could not connect");
mysql_select_db($dbDatabase, $li) or die ("could not select DB");
$name = mysql_real_escape_string($HTTP_POST_VARS["name"]);
$email = mysql_real_escape_string($HTTP_POST_VARS["email"]);
$comment = mysql_real_escape_string($HTTP_POST_VARS["comment"]);
$date = Date("Y-m-d h:i:s");
$gb_query = "insert into entries
values(0, $name , $email , $comment , $date )";
mysql_query($gb_query);
$res = mysql_affected_rows();
// See if insert was successful or not
if($res > 0) {
$ret_str="Your guestbook entry was successfully added!";
header( Location: guestbook.php );
exit(); // End the request
} else {
$ret_str = "There was a problem with your guestbook entry. Please try again.";
}
// Append success/failure message
$gb_str .= "<span class="ret">$ret_str</span><BR>";
mysql_close();
}
?>