search

Home  >  Q&A  >  body text

Please tell me what went wrong when the submission form is blank.

<?php

if(trim($_POST['password']) != trim($_POST['repassword'])){

exit ("twice The password used is inconsistent, please return to the previous page");

}

$username = trim($_POST['username'] );

$password = md5(trim($_POST['password']));

$conn = mysqli_connect('localhost ','root','root','informationtest','3306');

if(mysqli_error($conn)){

mysqli_error($conn);

exit;

}

mysqli_select_db($conn,'my_my');

mysqli_set_charset($conn, 'utf8');

insert into informationtest (id,name,password,) value('','$username','$password');

?>


  2549 days ago1742

reply all(7)I'll reply

  • dabour

    dabour2017-12-07 15:58:35

    You accessed the file directly, not through the server

    reply
    1
  •  

    Yes thanks I solved it

      · 2017-12-09 18:50:46
  • 路过

    路过2017-12-05 08:24:07

    Then you have to look at the html to see if there is no name

    reply
    0
  •  

    There is a name. Later I found that except Firefox, other browsers directly display the php code.

      · 2017-12-05 18:24:57
     

    <html> <body> <form action="connect.php" method="POST"> <table border="1" style="margin:100px auto"> <tr> <td>用户名</td> <td><input type="text" name="username" /></td> </tr> <tr> <td>密码</td> <td><input type="password" name="password" /></td> </tr> <tr> <td colspan=2 align = center><input type="submit" value="注册" name="submit" /></td> </tr> </table> </form> </body> </html> //以上是html代码

      · 2017-12-05 18:27:51
     

    Done, Baidu: access the website directory directly from localhost Suppose you have a static page index.html, copy the static page to your website directory, and then access it using localhost/index.html

      · 2017-12-05 19:23:57
     

    I use Notepad++ to open the browser, and the displayed address is file:///D:/phpStudy/PHPTutorial/WWW/login.html, not localhost/login.html, so the html jumps to directly display the php code. Although it was solved, the principle is still unclear.

      · 2017-12-05 19:26:11
  • Cancelreply