if(isset($_POST['submit']))没法执行

WBOY
Release: 2016-06-13 10:33:07
Original
920 people have browsed it

if(isset($_POST['submit']))无法执行


  添加管理员

  姓 名:
  密 码:
 
 




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();
  
  }
?>



点提交一直无法写入数据库,if(isset($_POST['submit']))根本不执行?求教

------解决方案--------------------
测试过你的代码是没有问题的,除非你这个页不是dealadduser.php

PHP code
Copy after login
//如1楼说的直接本页 添加管理员
姓 名: 密 码:

------解决方案--------------------
难道你的本页不是dealadduser.php页吗?
如果不是,dealadduser.php页应该是
PHP code
<?phpif (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();     }?><div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template