一个表单提交的问题
刚才写了一个注册页面
-----------------------------
详细代码
----------------------------<?php
include("config.php");
?>
<?php
if($_POST['mail'])
{
echo $sql="insert into account (id,email,password,reldate)"."values('','$_POST[mail]','$_POST[password],now())";
$query="mysql_query($sql)";
if($b)
{
echo"yes";
}
else{
echo "no";
}
}
?>
<style type="text/css">
<!--
body {
background-color: #CCC;
}
#post {
position:absolute;
left:312px;
top:114px;
width:718px;
height:233px;
z-index:1;
background-color: #FFFFFF;
}
-->
</style></head>
<body>
<div id="post">
<form id="form1" name="form1" method="post" action="sing.php">
<table width="351">
<tr>
<td width="343">
<input type="text" name="mail" id="mail" />
</td>
</tr>
<tr>
<td>
<input type="password" id="password" name="password" />
</td>
</tr>
<tr>
<td>
<input type="image" src="../signup.jpg" name="submit" id="submit" />
</td>
</tr>
</table>
</form>
------------------------------------------
写完后,我用echo输出SQL语句,看是否可以取到值,值是取到了,我用IF判断if($b)
{
echo"yes";
}
else{
echo "no";
}
插入成功为YES不成功为NO,ECHO结果为YES,我去数据库里看了一下,获取到的值没有插入进去,把ECHO出来的INSERT语句放到SQL里执行,里可以插入的。请问一下这是什么问题?
-----------------------------
详细代码
----------------------------<?php
include("config.php");
?>
<?php
if($_POST['mail'])
{
echo $sql="insert into account (id,email,password,reldate)"."values('','$_POST[mail]','$_POST[password],now())";
$query="mysql_query($sql)";
if($b)
{
echo"yes";
}
else{
echo "no";
}
}
?>
<style type="text/css">
<!--
body {
background-color: #CCC;
}
#post {
position:absolute;
left:312px;
top:114px;
width:718px;
height:233px;
z-index:1;
background-color: #FFFFFF;
}
-->
</style></head>
<body>
<div id="post">
<form id="form1" name="form1" method="post" action="sing.php">
<table width="351">
<tr>
<td width="343">
<input type="text" name="mail" id="mail" />
</td>
</tr>
<tr>
<td>
<input type="password" id="password" name="password" />
</td>
</tr>
<tr>
<td>
<input type="image" src="../signup.jpg" name="submit" id="submit" />
</td>
</tr>
</table>
</form>
------------------------------------------
写完后,我用echo输出SQL语句,看是否可以取到值,值是取到了,我用IF判断if($b)
{
echo"yes";
}
else{
echo "no";
}
插入成功为YES不成功为NO,ECHO结果为YES,我去数据库里看了一下,获取到的值没有插入进去,把ECHO出来的INSERT语句放到SQL里执行,里可以插入的。请问一下这是什么问题?
作者: bernovikes 发布时间: 2011-10-06
怎么没人回答
作者: jinank 发布时间: 2011-10-07