搜索

首页  >  问答  >  正文

请问提交表单是空白是哪里出错了

<?php

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

exit ("两次使用的密码不一致,请返回上一页");

}

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

?>


  2627 天前1783

全部回复(7)我来回复

  • dabour

    dabour2017-12-07 15:58:35

    你是直接访问了那个文件,而不是通过服务器访问的

    回复
    1
  •  

    是的,谢谢我解决了

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

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

    那你要看看html 是不是没有name

    回复
    0
  •  

    有name,后来我发现除了火狐,其他浏览器是直接显示php代码

      · 2017-12-05 18:24:57
     

    <正文> <表单操作=“connect.php”方法=“POST”> <表格边框=“1”样式=“边距:100px自动”> 用户名 <td><输入类型=“文本”名称=“用户名”/></td> 密码 <td><输入类型=“密码”名称=“密码”/></td> </表> </表格> </正文> </html> //以上是html代码

      · 2017-12-05 18:27:51
     

    搞定了,百度的:直接localhost访问网站目录 假设你有一个静态页index.html,将静态页拷到你的网站目录,然后是用localhost/index.html访问

      · 2017-12-05 19:23:57
     

    我用Notepad++打开浏览器的,显示的地址是file:///D:/phpStudy/PHPTutorial/WWW/login.html这样的,不是localhost/login.html,所以导致html跳转直接显示php代码。虽然解决了,但是原理还是懵逼。

      · 2017-12-05 19:26:11
  • 取消回复