Please tell me what went wrong when the submission form is blank.
 
  2017-12-04 19:45:52
0
7
1721

<?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');

?>


 
 

reply all(2)
dabour

You accessed the file directly, not through the server

  • reply Yes thanks I solved it
      author 2017-12-09 18:50:46
路过

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

  • reply There is a name. Later I found that except Firefox, other browsers directly display the php code.
      author 2017-12-05 18:24:57
  • reply &lt;html&gt; &lt;body&gt; &lt;form action="connect.php" method="POST"&gt; &lt;table border="1" style="margin:100px auto"&gt; &lt;tr&gt; &lt;td&gt;用户名&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="username" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;密码&lt;/td&gt; &lt;td&gt;&lt;input type="password" name="password" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan=2 align = center&gt;&lt;input type="submit" value="注册" name="submit" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; //以上是html代码
      author 2017-12-05 18:27:51
  • reply 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
      author 2017-12-05 19:23:57
  • reply 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.
      author 2017-12-05 19:26:11
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template