【php开源代码栏目提醒】:网学会员为广大网友收集整理了,input.php,希望对大家有所帮助!
<?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="write.php" 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>
<td colspan="2">标 题:
<input type="text" name="title" size="60" maxlength="50">
</td>
</tr>
<tr>
<td colspan="2">
<textarea name="content" rows="10" cols="100"></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>