php数据库留言板源码(php留言板开发)
本文目录一览:
完整的php&mysql的留言板源代码,可以运行的
input.htm
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="receive.php"
p您的姓名: input type="text" name="T1" size="20"/p
p您的性别:男input type="radio" value="0" name="R1"
女input type="radio" name="R1" value="1"/p
p您的EMAIL:input type="text" name="T2" size="35"/p
p您的留言内容:/p
p textarea rows="16" name="S1" cols="45"/textarea/p
p /p
p input type="submit" value="提交" name="B1"
input type="reset" value="重置" name="B2"/p
/form
/body
/html
receive.php
?php
$user='root';
$password='123';
$db='guestbook';
$table='gbook';
$ip=getenv(REMOTE_ADDR);
$sql = "INSERT INTO `guestbook`.`gbook` (`id`, `name`, `sex`, `email`, `info`, `ip`, `time_at`) VALUES (NULL, '$T1', '$R1', '$T2', '$S1', '$ip', NOW());";
$connect=mysql_connect('localhost',$user,$password);
mysql_select_db($db);
mysql_query($sql);
$result=mysql_query("select * from $table");
while ($arr=mysql_fetch_array($result))
{
if ($arr[2]==0)
$gender='先生';
else
$gender='女士';
?
html
head
meta http-equiv="Content-Language" content="zh-cn"
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
titleReceive/title
/head
body style="background-attachment: fixed"
table border="1" width="100%" id="table1" bgcolor="#FFFFFF"
tr
td bordercolor="#FFFFFF" bgcolor="#C0C0C0"?=$arr[6]?(?=$arr[5]?)p?=$arr[1]? ?=$gender?a href="?=$arr[3]?"?=$arr[3]?/a
写到:/td
/tr
tr
td?=$arr[4]?p /p
pa href="del.php?id=?=$arr[0]?"[删除]/a
a href="modify.php?id=?=$arr[0]?"[修改]/a]/td
/tr
/table
/body
/html
?php
echo 'p';
echo 'p';
}
?
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="input.htm"继续留言/a/p
/body
/html
del.php
?php
$user='root';
$password='123';
$db='guestbook';
$table='gbook';
$sql="DELETE FROM $table WHERE id=$id";
$connect=mysql_connect('localhost',$user,$password);
mysql_select_db($db);
$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="receive.php"返回首页/a/p
/body
/html
modify.php
?php
$user='root';
$password='123';
$db='guestbook';
$table='gbook';
$ip=getenv(REMOTE_ADDR);
$connect=mysql_connect('localhost',$user,$password);
mysql_select_db($db);
$result=mysql_query("select * from $table where id=$id");
$arr=mysql_fetch_array($result);
?
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="?=$arr[1]?"/p
p您的性别:
?php
if ($arr[2]==0) echo '男input type="radio" value="0" name="R1" checked
女input type="radio" name="R1" value="1"/p';
else echo '男input type="radio" value="0" name="R1"
女input type="radio" name="R1" value="1" checked/p';
?
p您的EMAIL:input type="text" name="T2" size="35" value="?=$arr[3]?"/p
p您的留言内容:/p
p textarea rows="16" name="S1" cols="45" ?=$arr[4]?/textarea/p
p /p
p input type="submit" value="修改" name="B1"
input type="reset" value="重置" 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="input.htm"继续留言/a/p
/body
/html
谁能提供一个PHP留言板源码
input.htm
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="receive.php"
p您的姓名: input type="text" name="T1" size="20"/p
p您的性别:男input type="radio" value="0" name="R1"
女input type="radio" name="R1" value="1"/p
p您的EMAIL:input type="text" name="T2" size="35"/p
p您的留言内容:/p
p textarea rows="16" name="S1" cols="45"/textarea/p
p /p
p input type="submit" value="提交" name="B1"
input type="reset" value="重置" name="B2"/p
/form
/body
/html
receive.php
?php
$user='root';
$password='123';
$db='guestbook';
$table='gbook';
$ip=getenv(REMOTE_ADDR);
$sql = "INSERT INTO `guestbook`.`gbook` (`id`, `name`, `sex`, `email`, `info`, `ip`, `time_at`) VALUES (NULL, '$T1', '$R1', '$T2', '$S1', '$ip', NOW());";
$connect=mysql_connect('localhost',$user,$password);
mysql_select_db($db);
mysql_query($sql);
$result=mysql_query("select * from $table");
while ($arr=mysql_fetch_array($result))
{
if ($arr[2]==0)
$gender='先生';
else
$gender='女士';
?
html
head
meta http-equiv="Content-Language" content="zh-cn"
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
titleReceive/title
/head
body style="background-attachment: fixed"
table border="1" width="100%" id="table1" bgcolor="#FFFFFF"
tr
td bordercolor="#FFFFFF" bgcolor="#C0C0C0"?=$arr[6]?(?=$arr[5]?)p?=$arr[1]? ?=$gender?a href="?=$arr[3]?"?=$arr[3]?/a
写到:/td
/tr
tr
td?=$arr[4]?p /p
pa href="del.php?id=?=$arr[0]?"[删除]/a
a href="modify.php?id=?=$arr[0]?"[修改]/a]/td
/tr
/table
/body
/html
?php
echo 'p';
echo 'p';
}
?
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="input.htm"继续留言/a/p
/body
/html
del.php
?php
$user='root';
$password='123';
$db='guestbook';
$table='gbook';
$sql="DELETE FROM $table WHERE id=$id";
$connect=mysql_connect('localhost',$user,$password);
mysql_select_db($db);
$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="receive.php"返回首页/a/p
/body
/html
modify.php
?php
$user='root';
$password='123';
$db='guestbook';
$table='gbook';
$ip=getenv(REMOTE_ADDR);
$connect=mysql_connect('localhost',$user,$password);
mysql_select_db($db);
$result=mysql_query("select * from $table where id=$id");
$arr=mysql_fetch_array($result);
?
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="?=$arr[1]?"/p
p您的性别:
?php
if ($arr[2]==0) echo '男input type="radio" value="0" name="R1" checked
女input type="radio" name="R1" value="1"/p';
else echo '男input type="radio" value="0" name="R1"
女input type="radio" name="R1" value="1" checked/p';
?
p您的EMAIL:input type="text" name="T2" size="35" value="?=$arr[3]?"/p
p您的留言内容:/p
p textarea rows="16" name="S1" cols="45" ?=$arr[4]?/textarea/p
p /p
p input type="submit" value="修改" name="B1"
input type="reset" value="重置" 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="input.htm"继续留言/a/p
/body
/html
求一个php的留言板源码
?php
$name= $_POST['name'];
$id=$_POST['id'];
$neirong=$_POST['neirong'];
try{
$mysql=mysql_connect("localhost",'sd','sd,')
}
cateh{}