日期:2014-05-17 浏览次数:20604 次
<form name="adduser" action="" method="POST">//如1楼说的直接本页 添加管理员<br> 姓 名: <input type="text" name="username"></br> 密 码: <input type="password" name="password"></br> <input type="submit" name="submit" value="提交"/> <input type="reset"> </form> <?php if(isset($_POST['submit'])) { mysql_connect("localhost","root",""); mysql_select_db("soft"); mysql_query("set character set gbk"); $username=$_POST["username"]; $password=$_POST["password"]; $sql="insert into `users`(`name`,`pass`) values ('$username','$password')"; echo $sql; mysql_query($sql); mysql_close(); } ?>
------解决方案--------------------
难道你的本页不是dealadduser.php页吗?
如果不是,dealadduser.php页应该是
<?php if(isset($_POST['submit'])) { mysql_connect("localhost","root",""); mysql_select_db("soft"); mysql_query("set character set gbk"); $username=$_POST["username"]; $password=$_POST["password"]; $sql="insert into `users`(`name`,`pass`) values ('$username','$password')"; echo $sql; mysql_query($sql); mysql_close(); } ?>