当前位置:首页 » 操作系统 » 网站留言板源码

网站留言板源码

发布时间: 2022-06-30 07:22:15

Ⅰ 在网页中制作1个留言板

这个还是用dreamweaver就行,

这就等于嵌入一个表格,
然后做个数据库保存留言内容就行,

然后再制作个网页读取数据库的留言就是

Ⅱ 求php语言编写的留言板源码!!!!!!!!!

这是一个简单的留言本,目前还没有后台管理程序。如果哪位高手能补上,那就太好了。

演示在http://www.ideawu.net/person/liuyan

留言保存在message.txt文件中,留言的格式为:date<$>ip<$>name<$>content
"<$>"为分隔符号

注意:源码文件和message.txt文件必须以gbk格式保存。如果你不知道如何保存文件为gbk格式,请咨询你的文本编辑器软件提供商。

/****************************************
* 本代码可以用作任何用途,但是与作者无关。
* 也就是,你使用本代码获取收益或者因此受
* 到损害,后果与作者无关。
****************************************/

file: index.php
代码:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title>留言板</title>
<link rel="stylesheet" href="../msg.css" type="text/css">
</head>
<body>
<br><B><FONT COLOR="#0000FF">图片留言板</FONT></B>
<center>
<table width="800" border="1" bordercolor="#88CCEE" cellspacing="0" cellpadding="4" style="border-collapse:collapse; word-break:break-all">
<tr><td style="border-right-style: none">
<form method="post" action="savemsg.php" style="font-size: 13px">
姓名:<br><input type="text" name="guest_name" maxlength=32 size=32><br>
留言:(字数:<font color="#0000FF"><span id=sNum>0</span></font>/256)<br>
<textarea class="textForm" name="guest_msg" cols="64" rows="8" onkeyup="sNum.innerHTML=this.value.length"></textarea><br>
<input class="button" type="submit" name="submit" value="发表留言">
<input class="button" type="reset" value="重置" name="reset">
</form>
</td></tr>
</table>
<?php
include("showmsg.php");
if(!empty($_GET['p'])){
$num=$_GET['p'];
showpage($num);
}else showpage(1);
?>
</center>
</body>
</html>

file: showmsg.php
代码:

<?php
function showpage($p)
{ ?>
<table width="800" border="0" bordercolor="#88CCEE" cellspacing="0" cellpadding="4" style="border-collapse:collapse; word-break:break-all;font-size:12px;">
<tr><td>
<p style="line-height: 100%; margin-top: 1; margin-bottom: 1" align="left">
<?php
$perPage=7; //每页显示留言数目
$num=$p;
if($num<1) $num=1;
$prev=$num-1;
$next=$num+1;
$page=$num-1; //当前页码
$fname="message.txt"; //存储留言的文件
$all_msg=file($fname); //将留言读入数组
$line_count=count($all_msg);
$page_count=ceil($line_count/$perPage);
if($prev>0)
echo "<a href=index.php?p=$prev>上一页</a>";
else
echo "上一页";
if($line_count>($next-1)*$perPage)
echo "<a href=index.php?p=$next>下一页</a>";
else
echo "下一页";
echo "当前第 ".$num." 页,共有".$page_count."页,".$line_count."条留言。";
?>
</p></td></tr>
</table>
<table width="800" border="1" bordercolor="#88CCEE" cellpadding="3" cellspacing="0" style="border-collapse:collapse; font-size:12px; word-break:normal; table-layout:fixed;">
<tr height="18" bgcolor="#5FBEF8"><td width="20%">
<b>留言时间/留言者</b></td><td width="86%"><b>留言内容</b>
</td></tr>
<?php
//显示留言
$bg1="#FBF9F9"; $bg2="#E9EFF4";$bg=$bg2;
for($n=$line_count-1-$page*$perPage;$line_count-1-$page*$perPage-$n<$perPage;$n--){
$bg=($bg==$bg1)? $bg2:$bg1; //变换背景颜色
if(!empty($all_msg[$n])){
list($date,$ip,$name,$msg)=explode("<$>",$all_msg[$n],4); //获取留言内容
echo "<tr bgcolor=$bg>";
echo "<td width=14%>".$date."<br><b>".$name."</b></td>";
echo "<td width=86%>".$msg."</td>";
echo "</tr>";
}
}
?>

</table>
<table width="800" border="0" bordercolor="#88CCEE" cellspacing="0" cellpadding="4" style="border-collapse:collapse; word-break:break-all;font-size:12px">
<tr><td>
<p style="line-height: 100%; margin-top: 2; margin-bottom: 2" align="left">
<?php
if($prev>0)
echo "<a href=index.php?p=$prev>上一页</a>";
else
echo "上一页";
if($line_count>($next-1)*$perPage)
echo "<a href=index.php?p=$next>下一页</a>";
else
echo "下一页";
echo "当前第 ".$num." 页,共有".$page_count."页,".$line_count."条留言。";
?>
</p></td></tr>
</table>
<?php } ?>

file: savemsg.php
代码:

<?php
$MSG_MAX_LEN=512; //留言最大长度
if (getenv("HTTP_CLIENT_IP"))
$ip= getenv("HTTP_CLIENT_IP");
elseif (getenv("HTTP_X_FORWARDED_FOR"))
$ip= getenv("HTTP_X_FORWARDED_FOR");
else
$ip= getenv("REMOTE_ADDR");
//获取IP地址结束
$date=date("Y年m月d日 H:i:s",time());
if(empty($_POST['guest_name']))
die("请填你的名字。<a href=index.php>Refresh</a>");
if(empty($_POST['guest_msg']))
die("请填写留言内容再提交。<a href=index.php>Refresh</a>");
$guest_name=strip_tags($_POST['guest_name']);
$guest_msg=substr($_POST['guest_msg'],0,$MSG_MAX_LEN);
//write message to file
//make the message be a line when stored
$guest_msg = str_replace( "\r\n", "\n", $guest_msg);
$guest_msg = str_replace( "\r", "\n", $guest_msg);
$guest_msg = str_replace(" "," ",$guest_msg);
$guest_msg = str_replace(">",">",$guest_msg);
$guest_msg = str_replace("<","<",$guest_msg);
$guest_msg = str_replace("\'","'",$guest_msg);
$guest_msg = nl2br($guest_msg);
//保存留言,以追加的形式
$fname="message.txt";
$fp=fopen($fname,"a+");
fwrite($fp,$date."<$>".$ip."<$>".$guest_name."<$>".$guest_msg."\n");
fclose($fp);
echo "<meta http-equiv='refresh' content='0;url=index.php'>";
?>

用于显示效果的样式表文件
file: msg.css
代码:

A:link {
color: #0033FF;
text-decoration: none;
}

A:visited {
color: #0033FF;
text-decoration: none;
}

A:hover {
color: #30A300;
text-decoration: underline;
}

A:active {
color: #0036A9;
text-decoration: none;
}

BODY{
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: 12px;
background: #FBF9F9;
}

TABLE{
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: 12px;
border-collapse: collapse;
table-layout: fixed;
margin: 0px;
}

Ⅲ 用DW网页制作!留言板怎么做!整个网页只要有留言的就行,求源代码!

<div id="apDiv2">

<table width="539" border="0">
<form id="form1" name="form1" method="post" action="">
<tr>
<td width="8"></td>
<td width="111"></td>
<td width="367"></td>
</tr>
<tr>
<td></td>
<td height="30"><div align="right" class="STYLE4">你的名字 :</div></td>
<td><label>
<input name="textfield" type="text" class="logininput" id="textfield" />
</label></td>
</tr>
<tr>
<td></td>
<td><div align="right"><span class="STYLE4">你的QQ :</span></div></td>
<td height="30"><label>
<input name="textfield2" type="text" class="logininput" id="textfield2" />
</label></td>
</tr>
<tr>
<td></td>
<td><div align="right"><span class="STYLE4"><span class="STYLE4"></span>你的邮箱 :</span></div></td>
<td height="30"><label>
<input name="textfield3" type="text" class="logininput" id="textfield3" />
</label></td>
</tr>
<tr>
<td height="120"></td>
<td><div align="right"><span class="STYLE4"><span class="STYLE4"></span>给我留言 :</span></div></td>
<td><label>
<textarea name="wenben02" cols="40" rows="6" id="wenben02"></textarea>
</label></td>
</tr>
<tr>
<td></td>
<td></td>
<td height="50">
<label>
<input name="button" type="submit" class="anniu" id="button" value="确 定" />
</label>
<label>
<input name="button2" type="reset" class="anniu" id="button2" value="重 置" />
</label>
</form>
</td>
</tr>
</table>
</div>

Ⅳ 谁给我个网站留言板源码,或者许愿墙源码,是不用登陆就可以留言的那种!!

留言板里面的index.asp 里面的代码,是可以复制到给留言的页面中的,主要是一个表格,接着呢就是一些参考的传递。

Ⅳ 编写一个asp留言板源代码

<link href="../../css/user.css" rel="stylesheet" type="text/css">
<script language="javaScript" src="../../js/common.js"></script>
<script language="JavaScript" src="../../js/ubbcode.js"></script>

<script language="JavaScript">
function formCheck()
{

if (document.theform.nickname.value == "")
{
alert("请填写名字。");
document.theform.nickname.focus();
return false;
}

if (document.theform.content.value == "")
{
alert("请填写留言内容。");
document.theform.content.focus();
return false;
}
theform.Submit.disabled=true;
return true;
}

function showimage()
{
document.images.faceimg.src=face_image[parseInt(document.theform.face.options[document.theform.face.selectedIndex].value)];
}
<body background="http://cache26.51.com/photo1/14/cf/amulostlove/1151766298434_1.jpg">
<center>
<IFRAME marginHeight=0 marginWidth=0 noResize scrolling=no frameBorder=0 src="http://ads.activepower.net/script/ad/ad_show.asp?group_id=8&bgcolor=ffffff" width=468 height=60>
</IFRAME>
</center>
<p> </p>
<form name="theform" onsubmit="return formCheck();" method="post" action="get_post.asp">
<TABLE width=550 border=0 align="center" cellPadding=0 cellSpacing=0>
<table width="550" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#ebebeb">
<tr>
<td class="pt9">
<p>*名字:
<input name="nickname" type="text" size="15" maxlength="12" class="inputbox1">
<br>
Email:
<input name="email" type="text" size="15" maxlength="45" class="inputbox1">
主页地址:
<input name="hp_url" type="text" value="http://" size="22" maxlength="125" class="inputbox1">
</p>
</td>
<tr>
<td width="409" class="pt9"> <!--因为图片连接的原因,本文件只适合include在script/dirname下的文件 -->
<img onClick=bold() src="../../images/icon_editor_bold.gif" width="23" height="22" alt="粗体" border="0"><img onClick=italicize() src="../../images/icon_editor_italicize.gif" width="23" height="22" alt="斜体" border="0"><img onClick=underline() src="../../images/icon_editor_underline.gif" width="23" height="22" alt="下划线" border="0">

<img onClick=center() src="../../images/icon_editor_center.gif" width="23" height="22" alt="居中" border="0"><img onClick=hyperlink() src="../../images/icon_editor_url.gif" width="23" height="22" alt="超级连接" border="0"><img onClick=email() src="../../images/icon_editor_email.gif" width="23" height="22" alt="Email连接" border="0"><img onClick=image() src="../../images/icon_editor_image.gif" width="23" height="22" alt="图片" border="0"><img onClick=flash() src="../../images/icon_swf.gif" width="23" height="22" alt="Flash图片" border="0"><img onClick=showcode() src="../../images/icon_editor_code.gif" width="23" height="22" alt="编号" border="0"><img onClick=quote() src="../../images/icon_editor_quote.gif" width="23" height="22" alt="引用" border="0"><img onClick=list() src="../../images/icon_editor_list.gif" width="23" height="22" alt="目录" border="0">

<br>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="pt9">
<tr>
<td width="40" valign="top">*留言:</td>
<td><textarea name="content" cols="50" rows="6" id="content"></textarea></td>
</tr>
</table>
<p align="center">
<input name="replyer" type="hidden" value="">
<input name="reply_content_id" type="hidden" value="">
<input name="userid" type="hidden" value="79444">
<input type="submit" name="Submit" value="确认留言" class="button1">
<input type="reset" name="Reset" value="取消重写" class="button1">
</p></td>
</tr>
</table>
<p> </p>
</form>
<table width="550" border="0" align="center" cellpadding="2" cellspacing="1">
<tr>
<td width="88" valign="top">
<img src="http://img.mms.sohu.com/mms/1230/86/32486/p2.gif">

</td>
<td width="417"><TABLE width="100%" border=0 cellPadding=0 cellSpacing=0 class="pt9">
<TBODY>
<TR>
<TD width=43 colSpan=2 height=29 rowSpan=2><IMG height=29
src="../../images/1_r2_c2.gif" width=43 border=0></TD>
<TD background=../../images/1_r2_c4.gif height=10></TD>
<TD width=37 colSpan=2 height=29 rowSpan=2><IMG height=29
src="../../images/1_r2_c6.gif" width=37 border=0></TD>
</TR>
<TR>
<TD height=19> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class="pt9"> <font class="filtertxt">dsfsd</font> </TD>
<TD width="168" align=right class="pt9"> </TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
<TR>
<TD width=10 background=../../images/1_r4_c2.gif></TD>
<TD width=27></TD>
<TD width="100%" height=50> <img src="../../images/blank.gif" width="5" height="5">
<br> fdsfsd<b>dfssdfsdf</b> <br> <img src="../../images/blank.gif" width="5" height="5"> </TD>
<TD width=22></TD>
<TD width=15 background=../../images/1_r4_c2.gif></TD>
</TR>
<TR>
<TD background=../../images/1_r4_c2.gif></TD>
<TD></TD>
<TD height=1><hr width="100%" size="1" noshade></TD>
<TD></TD>
<TD background=../../images/1_r4_c2.gif></TD>
</TR>
<TR>
<TD width=43 colSpan=2 height=26 rowSpan=2> <IMG height=26 src="../../images/1_r6_c2.gif" width=43 border=0></TD>
<TD align=right height=17>
<img src="../../images/no_home.gif" align="absmiddle"> <img src="../../images/no_email.gif" align="absmiddle"> <FONT color=#336600>[2006-7-17 21:24:00]</FONT> </TD>
<TD width=43 colSpan=2 height=26 rowSpan=2><IMG height=26
src="../../images/1_r6_c6.gif" width=37 border=0></TD>
</TR>
<TR>
<TD background=../../images/1_r2_c4.gif
height=9></TD>
</TR>
</TBODY>
</TABLE></td>
</tr>
</table>
<BR>
<form>
<table width="516" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<table width=100% border=0 cellspacing=1 cellpadding=2 class=pt9><tr><td height=13><img src=../../images/turnpage2_1.gif align=absmiddle border=0> <img src=../../images/turnpage2_2.gif align=absmiddle border=0> <b>1</b> | <img src=../../images/turnpage2_3.gif align=absmiddle border=0> <img src=../../images/turnpage2_4.gif align=absmiddle border=0></td><td class=pt9 width=140 align=right>共<font color=red>1</font>页第<input type=text name=JumpPage maxlength=3 size=3>页<input type=button value=转页 onClick="location.href='/script/user/list.asp?userid=79444&page=' + this.form.JumpPage.value;"></td></tr></table>
</td>
</tr>
</table>
</form>

Ⅵ 谁能提供一个PHP留言板源码

我自己有一个简单的留言板系统,
里面有简单的增删改查功能,需要会数据库。
希望可以帮助到有缘的学习爱好者。

这是首页index.php代码:

<html>

<head>

<title>我的留言本</title>

<script type ="text/javascript">

function dodel(id){

if(confirm("确定要删除吗?")){

window.location="action.php?action=del&id="+id;

}

}


</script>


<style type = "text/css">

*{font-family:"微软雅黑";}

body{

background:url(images/bg.gif);

}

a{color:#000;text-decoration:none;}

a:hover{text-decoration:underline;}

td{text-align:center;}

table{

border:3px solid #9b9b9b;

background:#E9E9E9;

}

td{

color:#660000;

}

</style>

</head>

<body>

<center>

<?php include("menu.php"); ?>

<h3>浏览新闻</h3>

<table width ="880" border="1" cellpadding="3">

<tr>

<th>新闻id</th><th>新闻标题</th><th>关键字</th><th>作者</th><th>发布时间</th><th>新闻内容</th><th>操作</th>

</tr>

<?php

//1.导入配置文件

require("dbconfig.php");

//2.链接mysql数据库,选择数据库

$link = @mysql_connect(HOST,USER,PASS)or die("数据库连接失败!");

mysql_select_db(DBNAME,$link);


//3.执行查询,并返回结果

$sql="select * from news order by addtime desc";

$result = mysql_query($sql,$link);



//4.解析结果集,并遍历输出

while($row = mysql_fetch_assoc($result)){

echo"<tr>";

echo"<td>{$row['id']}</td>";

echo"<td>{$row['title']}</td>";

echo"<td>{$row['keywords']}</td>";

echo"<td>{$row['author']}</td>";

echo"<td>{$row['addtime']}</td>";

echo"<td>{$row['content']}</td>";

echo"<td>

<a href='javascript:dodel({$row['id']})'>删除</a>

<a href='edit.php?id={$row['id']}'>修改</a></td>";

echo"</tr>";


}



//5.释放结果集

mysql_free_result($result);

mysql_close($link);

?>

</table>

</center>

</body>

</html>

Ⅶ 求php留言板代码,就是按提交后直接显示在页面的,在留言,再增加一条

[M][ftc=#EE1000][fts=6][ftf=Webdings]Y[/ft][/ft][/ft]
[ftc=#00BFF3]﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌[/ft]
[ftc=#FFF100]对



点,






长;[/ft]
[ffg,#F68E54,#FFFFFF]对





点,因










见。[/ft]
[ftc=#00BFF3]——————————————————————————
[ftc=#EE1D24]◣[/ft][ftc=#FFF100]◤[/ft]
[ftc=#37B400]◢[/ft][ftc=#00AEEF]◥[/ft][/M][M][/M][M][/M][M][/M][M][/M][M][/M]
[M][ftc=000000][/ft][/M][/ft][/ft][/ft][/ft][/ft][/ft][/ft][/ft][/ft][/ft][/M][/M][/M][/M][/M][/M][/M][/M][/M][/M][/M][/M][/M]

Ⅷ 网页留言栏的代码

在<HEAD>里添加</script>

<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert")) = "userinfo") Then

MM_editConnection = MM_conn_STRING
MM_editTable = "user"
MM_editRedirectUrl = "index005.asp"
MM_fieldsStr = "username|value|Usermail|value|Userqq|value|Address|value|Postcode|value|Usertel|value|url|value|zhuti|value|Communication|value"
MM_columnsStr = "Username|',none,''|Usermail|',none,''|Userqq|',none,''|Address|',none,''|Postcode|',none,''|Usertel|',none,''|url|',none,''|zhuti|',none,''|Communication|',none,''"

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If

End If
%>

在<BODY>里添加
<table width="534" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="css1">
<tr>
<td><table width="96%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" height="152" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="13%" height="19" align="right" class="STYLE2">用户名:</td>
<td width="35%"><div align="left">
<label>
<input name="username" type="text" id="username" value="游客" size="25" />
</label>
</div></td>
<td width="15%" class="STYLE2">E-mail:</td>
<td width="37%"><input name="useremail" type="text" class="input0" id="useremail" size="25" /></td>
</tr>
<tr>
<td height="19"><div align="right" class="STYLE2">qq:</div></td>
<td><div align="left">
<label>
<input name="userqq" type="text" class="input0" id="userqq" size="25" />
</label>
</div></td>
<td><div class="STYLE2">个人主页:</div></td>
<td><input name="url" type="text" class="input0" id="url" value="http://" size="25" /></td>
</tr>
<tr>
<td height="19"><div align="right" class="STYLE2">主题:</div></td>
<td colspan="3"><div align="left">
<label>
<input name="zhuti" type="text" class="input0" id="zhuti" size="40" />
</label>
</div></td>
</tr>
<tr>
<td height="65" align="right"><span class="STYLE2">内容:</span></td>
<td colspan="3"><label> </label>
<div align="left">
<textarea name="Communication" cols="60" rows="4" class="input0" id="Communication"></textarea>
</div></td>
</tr>
<tr>
<td colspan="4" class="STYLE79"><table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><label> </label>
<div align="center">
<input name="regSubmit" type="submit" class="css2" id="regSubmit" onClick="return check();" value="留言" />
</div></td>
<td><label> </label>
<div align="center">
<input name="Submit5" type="reset" class="css2" id="Submit5" value="重置" />
</div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="userinfo" />
<script language="JavaScript" type="text/javascript">
function check()
{
// if(document.userinfo.username.value=="")
// { document.userinfo.username.focus();
// alert("用户名不能为空!");
// return false;
// }
// if(document.userinfo.username.value.length < 4)
// { document.userinfo.username.focus();
// alert("用户名的长度不小于4个字符!");
// return false;
// }
if(document.userinfo.useremail.value=="")
{ document.userinfo.useremail.focus();
alert("Email 不能为空!");
return false;
}
if(document.userinfo.useremail.value.charAt(0)=="."||
document.userinfo.useremail.value.charAt(0)=="@"||
document.userinfo.useremail.value.indexOf('@',0) == -1||
document.userinfo.useremail.value.indexOf('.',0) == -1||
document.userinfo.useremail.value.lastIndexOf("@")==document.userinfo.useremail.value.length-1 ||
document.userinfo.useremail.value.lastIndexOf(".")==document.userinfo.useremail.value.length-1)
{
alert("Email地址格式不正确!");
document.userinfo.useremail.focus();
return false;

}

if(document.userinfo.Address.value=="")
{ document.userinfo.Address.focus();
alert("地址不能为空!");
return false;
}

if(document.userinfo.Postcode.value=="")
{ document.userinfo.Postcode.focus();
alert("邮编请认真填写!");
return false;
}
if(document.userinfo.Communication.value=="")
{
document.userinfo.Communication.focus();
alert("您需要的项目内容不为空!");
return false;
}
return true
}
</script>
</td>
</tr>
</table>
<hr size="1" color="#101010" />
</td>
</tr>
</table>

Ⅸ 最简单php留言板源码。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
</head>
<body>
<BR><BR>
<center><a href="admin_login.htm" target="_blank">留言管理</a> </center><BR><BR>
<br><br><br>
<form method="post" >
<p>姓名:
<input type="text" name="user_name" size="20">
</p>
<p><br>
电话:
<input type="text" name="user_tel" size="20">
</p>
<p><br>
留言:
<textarea name="user_post" rows="5" cols="20"></textarea>
</p>
<p>
<input type="submit" value="提交留言" name="Submit">

</p>
</form>
<br><br><br>
<font color="red">最新留言如下:<BR><BR></font>
<?php
if($_POST['Submit']){
$user_name=$_POST['user_name'];
$user_tel=$_POST['user_tel'];
$user_post=$_POST['user_post'];
$ah=$_POST['ah'];
$where=$_POST['where'];
$str.="姓名:".$user_name."\r\n电话:".$user_tel."\r\n留言:".$user_post;
$k=fopen("liuyanban.txt","w+");
fwrite($k,$str);
fclose($k);
echo "保存成功!";
}
?>
</body>
</html>

Ⅹ 完整的php&mysql的留言板源代码,可以运行的

input.htm

<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>input</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">
<title>Receive</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>
<p><a 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>

<p><a 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>

<p><a 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">
<title>input</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>

<p><a href="input.htm"><继续留言></a></p>

</body>

</html>

热点内容
膏子药存储 发布:2024-11-16 16:02:34 浏览:682
安卓红包雷神怎么样 发布:2024-11-16 15:53:17 浏览:392
支付密码是对的怎么办 发布:2024-11-16 15:45:20 浏览:176
安卓动态库反编译 发布:2024-11-16 15:23:04 浏览:374
什么是奥维服务器lp地址 发布:2024-11-16 15:20:13 浏览:10
c数字图像处理源码 发布:2024-11-16 15:13:28 浏览:402
为什么苹果处理器一直比安卓好 发布:2024-11-16 15:13:22 浏览:153
折标算法 发布:2024-11-16 15:07:10 浏览:475
如何做好编译类节目 发布:2024-11-16 14:56:51 浏览:977
正版激活服务器搭建 发布:2024-11-16 14:47:04 浏览:778