我的注册字段未插入数据库,只是递增了行。
HTML标记:
<body><h1 class="headingStyle">Sign Up</h1>
<form action="SignUp.php" method="post">
<table width="284" border="1" align="center">
<tr>
<td width="128" class="style1">User Name</td>
<td width="144"><input type="text" name="u_name" id="u_name"></td>
</tr>
<tr>
<td class="style1">Email</td>
<td><input type="text" name="email" id="email"></td>
</tr>
<tr>
<td class="style1">Password</td>
<td><input type="password" name="pass" id="pass"></td>
</tr>
<tr>
<td colspan="2" class="buttonStyle"><input type="submit" name="submit" value="Sign Up"></td>
</tr>
</table>
</form>
</body>
这是php代码,它不会在我的表中插入任何东西只是递增行。我也给了我桌子的快照。
<?php
$conn = mysql_connect("localhost", "root", "") or die(mysql_error());
$db = mysql_select_db('aartycrafty_db', $conn) or die(mysql_error());
if (isset($_POST['submit'])) /*if sign up button is pressed than */
{
$name = $_POST['u_name'];
$email = $_POST['email'];
$pass = $_POST['pass'];
if($name == '')
{
echo "<script>alert('Please Enter Your Name')</script>";
exit();
}
if($email == '')
{
echo "<script>alert('Please Enter Your Email')</script>";
exit();
}
if($pass == '')
{
echo "<script>alert('Please Enter Your Password')</script>";
exit();
}
}
else {
$query = "insert into signup_tb (u_name, u_email, u_pass) values ('$name', '$email', '$pass')";
if(mysql_query($query)){
echo "<script>window.open('home.php')</script>";
}
}
?>