我创建了一个添加用户页面,可以将用户添加到数据库中,下面的代码我想比较两个文本框,如果它们匹配(密码=一致密码)那么它应该插入数据库中,怎么能我在php中实现了
<?php
require("../connect.php");
error_reporting(0);
/*
if(!(adminsessioncheck()))
header('location:index.php'); */
if(isset($_POST['add']))
{
$username=$_POST['username'];
$password=$_POST['password'];
mysql_query("INSERT INTO user VALUES('','$username','$password')") or die(mysql_error());
}
?>
<div style=" width:250px; margin-left:auto; margin-right:auto;">
<div class="heading1" style="text-align:center">Add a new User</div>
<br>
<form action="" method="post" onsubmit="msgbox()">
<table width="330" height="135" border="0" class="text">
<tr>
<td><label>User Name</label></td>
<td><input type="text" name="username" id="username" required></td>
</tr>
<tr>
<td><label>Password</label></td>
<td><input type="password" id="password" name="password" required></td>
</tr>
<tr>
<td><label>Confirm Password</label></td>
<td><input type="password" id="cpassword" name="cpassword" required></td>
</tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td><td align="center"><input type="submit" name="add" value="Add"></td></tr>
</table>
</form>
</div>
</div>