【php开源代码栏目提醒】:网学会员为需要php开源代码的朋友们搜集整理了reply_input.php相关资料,希望对各位网友有所帮助!
<?php
// 包含数据库连接文件和头文件
require ('dbconnect.php');
include('head.php');
?>
<html>
<script language="javascript">
function checkmessage()
{
if (msgform.username.value=="")
{
// 如果用户名为空,则显示警告信息
alert("用户名不能为空!");
msgform.username.focus();
return false;
}
if (msgform.password.value=="")
{
// 如果用户密码为空,则显示警告信息
alert("用户密码不能为空!");
msgform.password.focus();
return false;
}
if (msgform.email.value=="")
{
// 如果Email为空,则显示警告信息
alert("Email不能为空!");
msgform.email.focus();
return false;
}
// 检查email格式是否正确
else if (msgform.email.value.charAt(0)=="." ||
msgform.email.value.charAt(0)=="@"||
msgform.email.value.indexOf('@', 0) == -1 ||
msgform.email.value.indexOf('.', 0) == -1 ||
msgform.email.value.lastIndexOf("@")==msgform.email.value.length-1 ||
msgform.email.value.lastIndexOf(".")==msgform.email.value.length-1)
{
alert("Email的格式不正确!");
msgform.email.select();
return false;
}
if (msgform.title.value=="")
{
// 如果留言标题为空,则显示警告信息
alert("留言标题不能为空!");
msgform.title.focus();
return false;
}
if (msgform.content.value=="")
{
// 如果留言内容为空,则显示警告信息
alert("留言内容不能为空!");
msgform.content.focus();
return false;
}
return true;
}
</script>
<body bgcolor="#FFFFFF" text="#000000">
<h1 align=center><font color=blue>多谢回复</font></h1>
<form name="msgform" method="post" action="reply.php?firstmesid=<? echo $info[firstMesID];?>&lastmesid=<? echo $info[MesID];?>" enctype="multipart/form-data" onsubmit="return checkmessage()">
<table width="64%" border="0" cellspacing="1" cellpadding="3" bgcolor="#66CCFF" align="center">
<tr>
<td width="48%">用 户:
<input type="text" name="username">
</td>
<td width="52%"> 密 码:
<input type="pass
word" name="password">
</td>
</tr>
<tr>
<td width="48%">性 别:
<select name="select" size="1">
<option>不告诉你</option>
<option>帅哥</option>
<option>美女</option>
</select>
</td>
<td width="52%">Email:
<input type="text" name="email" maxlength="50">
</td>
</tr>
<tr>
<td colspan="2">留 言:
<input type="checkbox" name="checkbox" value="Y">
隐藏IP </td>
</tr>
<tr>
<?
// 得到上一页的参数
$firstmesid=$_GET[firstmesid];
$lastmesid=$_GET[lastmesid];
// print $firstmesid;
// 连接数据库表,要回复的文章的获得标题
$firstsql="select * from guestbook where MesID='$firstmesid'";
$first_re=mysql_query($firstsql,$conn);
$first_ar=my
sql_fetch_array($first_re);
$title="[回复]".$first_ar[title];
// 连接数据库表,要回复的文章的获得内容
$lastsql="select * from guestbook where MesID='$lastmesid'";
$last_re=
mysql_query($lastsql,$conn);
$last_ar=mysql_fetch_array($last_re);
// 如果原文章内容超过50 byte,则回复贴中只保留50 byte
$old_content=substr($last_ar[content],0,50);
?>
<td colspan="2">标 题:
<input type="text" name="title" size="60" value=<? echo $title;?> maxlength="50">
<!--需要两个隐含input框用来传递firstmesid和lastmesid参数 -->
<input type="hidden" name="firstmesid" value=<?echo $firstmesid;?>>
<input type="hidden" name="lastmesid" value=<?echo $lastmesid;?>>
</td>
</tr>
<tr>
<td colspan="2">
<textarea name="content" rows="10" cols="100" >
---------------------------------
原主题:
<? echo $old_content;?></textarea>
</td>
</tr>
<tr>
<td>
<div align="right">
<input type="submit" name="Submit" value="提交">
</div>
</td>
<td>
<input type="reset" name="Rewrite" value="重写">
</td>
</tr>
</table>
</form>
</body>
</html>