首页上一页 1 下一页尾页 1 条记录 1/1页
php开发典型模块大全第5章
发表在PHP图书答疑
2010-04-06
是否精华
是
否
版块置顶:
是
否
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
<form action="houtai_ok.php" method="post" name="form1" id="form1" onSubmit="return check_input(form1)">
<tr>
<td height="30" colspan="3"> </td>
</tr>
<tr>
<td width="106" height="30" align="right" class="STYLE11">歌名:</td>
<td width="674" height="30" colspan="2">
<input name="tb_forum_music" type="text" class="inputcss" id="tb_forum_music" size="55" />
</td>
</tr>
<tr>
<td height="30" align="right" class="STYLE11">歌手:</td>
<td height="30" colspan="2">
<input name="tb_forum_geshou" type="text" id="tb_forum_geshou" size="55"></td>
</tr>
<tr>
<td height="30" align="right" class="STYLE11">歌曲路径:</td>
<td height="30" colspan="2">
<input name="tb_forum_lujing" type="text" id="tb_forum_lujing" size="55" />
</td>
</tr>
<tr>
<td height="50" colspan="3"><div align="center">
<input type="submit" name="submit" value="提交注册信息" />
<input name="reset" type="reset" value="重新填写注册信息" />
</div></td>
</tr>
</form>
</table>
</body>
</html>
这是处理页面
<?php
include_once("conn/conn.php");
$tb_forum_music=trim($_POST[tb_forum_music ]);
$sql=mysql_query("select tb_forum_music from tb_forum_music where tb_forum_music='$tb_forum_music'",$conn);
$info=mysql_fetch_array($sql);
if($info!=false){
echo "<script language='javascript'>alert('对不起,该歌曲已经添加!');history.back();</script>";
exit;
}
$tb_forum_music=trim($_POST[tb_forum_music]);
$tb_forum_geshou=trim($_POST[tb_forum_geshou]);
$tb_forum_lujing=trim($_POST[tb_forum_lujing]);
$tb_forum_date=date("Y-m-d h:i:s");
$tb_forum_id=1;
$query=mysql_query("insert into
tb_forum_music(tb_forum_music,tb_forum_geshou,tb_forum_type,tb_forum_lujing,tb_forum_date,)
values('$tb_forum_music','$tb_forum_geshou','$tb_forum_lujing','$tb_forum_type','$tb_forum_date',)",$conn);
if($query==true){
session_register("tb_forum_music");
$_SESSION["tb_forum_music"]=$tb_forum_user;
echo "<script>alert('注册成功!');window.location.href='index.php';</script>";
}else{
echo "<script language='javascript'>alert('对不起,注册失败!');history.back();</script>";
exit;
}
?>
这是数据库
tb_forum_id int(10) 否
tb_forum_geshou varchar(50) 否
tb_forum_lujing varchar(100) 否
tb_forum_date datetime 否
tb_forum_music varchar(50) 否
索引:
键名 类型 唯一 紧凑 字段 基数 整理 空 注释
PRIMARY BTREE 是 否 tb_forum_id 0 A
已用空间: 类型 已用
数据 0 字节
索引 1,024 字节
总计 1,024 字节
行统计: 说明 值
格式 动态
行数 0
创建时间 2010 年 04 月 06 日 00:48
最后更新 2010 年 04 月 06 日 00:48
为什么我想往里面注册 总是注册失败那 ......
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
<form action="houtai_ok.php" method="post" name="form1" id="form1" onSubmit="return check_input(form1)">
<tr>
<td height="30" colspan="3"> </td>
</tr>
<tr>
<td width="106" height="30" align="right" class="STYLE11">歌名:</td>
<td width="674" height="30" colspan="2">
<input name="tb_forum_music" type="text" class="inputcss" id="tb_forum_music" size="55" />
</td>
</tr>
<tr>
<td height="30" align="right" class="STYLE11">歌手:</td>
<td height="30" colspan="2">
<input name="tb_forum_geshou" type="text" id="tb_forum_geshou" size="55"></td>
</tr>
<tr>
<td height="30" align="right" class="STYLE11">歌曲路径:</td>
<td height="30" colspan="2">
<input name="tb_forum_lujing" type="text" id="tb_forum_lujing" size="55" />
</td>
</tr>
<tr>
<td height="50" colspan="3"><div align="center">
<input type="submit" name="submit" value="提交注册信息" />
<input name="reset" type="reset" value="重新填写注册信息" />
</div></td>
</tr>
</form>
</table>
</body>
</html>
这是处理页面
<?php
include_once("conn/conn.php");
$tb_forum_music=trim($_POST[tb_forum_music ]);
$sql=mysql_query("select tb_forum_music from tb_forum_music where tb_forum_music='$tb_forum_music'",$conn);
$info=mysql_fetch_array($sql);
if($info!=false){
echo "<script language='javascript'>alert('对不起,该歌曲已经添加!');history.back();</script>";
exit;
}
$tb_forum_music=trim($_POST[tb_forum_music]);
$tb_forum_geshou=trim($_POST[tb_forum_geshou]);
$tb_forum_lujing=trim($_POST[tb_forum_lujing]);
$tb_forum_date=date("Y-m-d h:i:s");
$tb_forum_id=1;
$query=mysql_query("insert into
tb_forum_music(tb_forum_music,tb_forum_geshou,tb_forum_type,tb_forum_lujing,tb_forum_date,)
values('$tb_forum_music','$tb_forum_geshou','$tb_forum_lujing','$tb_forum_type','$tb_forum_date',)",$conn);
if($query==true){
session_register("tb_forum_music");
$_SESSION["tb_forum_music"]=$tb_forum_user;
echo "<script>alert('注册成功!');window.location.href='index.php';</script>";
}else{
echo "<script language='javascript'>alert('对不起,注册失败!');history.back();</script>";
exit;
}
?>
这是数据库
tb_forum_id int(10) 否
tb_forum_geshou varchar(50) 否
tb_forum_lujing varchar(100) 否
tb_forum_date datetime 否
tb_forum_music varchar(50) 否
索引:
键名 类型 唯一 紧凑 字段 基数 整理 空 注释
PRIMARY BTREE 是 否 tb_forum_id 0 A
已用空间: 类型 已用
数据 0 字节
索引 1,024 字节
总计 1,024 字节
行统计: 说明 值
格式 动态
行数 0
创建时间 2010 年 04 月 06 日 00:48
最后更新 2010 年 04 月 06 日 00:48
为什么我想往里面注册 总是注册失败那 ......