php留言版数据库的代码 php留言版数据库的代码是什么( 三 )


?
html
head
meta http-equiv="Content-Language" content="zh-cn"
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
titleinput/title
/head
body
form method="POST" action="modify_ok.php?id=?=$id?"
p您的姓名: input type="text" name="T1" size="20" value="https://www.04ip.com/post/?=$arr[1]?"/p
p您的性别:
?php
if ($arr[2]==0) echo '男input type="radio" value="https://www.04ip.com/post/0" name="R1" checked
女input type="radio" name="R1" value="https://www.04ip.com/post/1"/p';
else echo '男input type="radio" value="https://www.04ip.com/post/0" name="R1"
女input type="radio" name="R1" value="https://www.04ip.com/post/1" checked/p';
?
p您的EMAIL:input type="text" name="T2" size="35" value="https://www.04ip.com/post/?=$arr[3]?"/p
p您的留言内容:/p
p textarea rows="16" name="S1" cols="45" ?=$arr[4]?/textarea/p
p /p
pinput type="submit" value="https://www.04ip.com/post/修改" name="B1"
input type="reset" value="https://www.04ip.com/post/重置" name="B2"/p
/form
/body
/html
modify_ok.php
?php
$user='root';
$password='123';
$db='guestbook';
$table='gbook';
$connect=mysql_connect('localhost',$user,$password);
mysql_select_db($db);;
$sql = "UPDATE `guestbook`.`gbook` SET `name` = '$T1', `sex` = '$R1', `email` = '$T2', `info` = '$S1' WHERE `gbook`.`id` = '$id' LIMIT 1;";
$result=mysql_query($sql);
if ($result)
echo "修改成功";
else
echo "修改失败";
?
html
head
meta http-equiv="Content-Language" content="zh-cn"
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
title新建网页 1/title
/head
body
pa href="https://www.04ip.com/post/input.htm"继续留言/a/p
/body
/html
php留言本代码! 【求详细解析】谢谢没有注释php留言版数据库的代码的php部分我都写php留言版数据库的代码了注释,html不用教吧
?
//Chap25 留言本
$fileName="data.txt";//数据保存文件名
if($action == "send")//判断用户是否提交数据
{
$message = ereg_replace("\r\n", "br", $message);//回车替换成htmlphp留言版数据库的代码的换行标签
$message = ereg_replace(" ", "", $message);//一个空格替换成两个空格,莫名,而且为什么不是str_replace,效率啊效率,这多少年前的代码
$Today = date("F dS, Y");//取当天日期
$data =https://www.04ip.com/post/$name."\r\n".$Today."\r\n".$message."\r\n";//代码不完整,我不知道name是谁送来的
$fileContent = fopen("$fileName","a");//打开数据保存的文件,以只写方式
if(chop($name)!="" Chop($message)!="")//已经有注释了
//删除字符串结尾的空白字符
{
fwrite($fileContent,"$data");//写入数据
fclose($fileContent);//关闭文件句柄
}
$action ="";//清空$action变量,避免影响下面的提交页面
}
?
html
head
titleGB/title
/head
body bgcolor=#ffffff text="#333333"
?
if(file_exists($fileName))//如果文件存在,执行:
{
$fileMessage=file($fileName);
//将文件$fileName中所有内容读入数组$fileName
//一行内容保存在一个数组元素中
}
$count=count($fileMessage)/3;
//计算地址薄条目的数目php留言版数据库的代码,三行字符表示一个地址簿条目
?
table width="99%" border="0" bgcolor="#ffefb0"
?
print(" trtd colspan=\"2\"bgcolor=\"#fffae6\"留言数:".$count."/td/tr\r\n");
for($i=0; $fileMessage[$i]!="";)//显示所有留言
{
print("tr\r\n");
print("td");
print("Name: font color=\"#ff0000\"".$fileMessage[$i++]."/font/td\r\n");
print("tddiv align=\"right\"font color=\"#777777\"'.$fileMessage[$i++]."/font/div/td");

推荐阅读