请问提交表单是空白是哪里出错了
 
  2017-12-04 19:45:52
[PHP讨论组]

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

?>


 
 

全部回复(2)
dabour

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

  • 回复 是的,谢谢我解决了
      作者 2017-12-09 18:50:46
路过

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

  • 回复 有name,后来我发现除了火狐,其他浏览器是直接显示php代码
      作者 2017-12-05 18:24:57
  • 回复 &lt;html&gt; &lt;body&gt; &lt;form action=&quot;connect.php&quot; method=&quot;POST&quot;&gt; &lt;table border=&quot;1&quot; style=&quot;margin:100px auto&quot;&gt; &lt;tr&gt; &lt;td&gt;用户名&lt;/td&gt; &lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;username&quot; /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;密码&lt;/td&gt; &lt;td&gt;&lt;input type=&quot;password&quot; name=&quot;password&quot; /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan=2 align = center&gt;&lt;input type=&quot;submit&quot; value=&quot;注册&quot; name=&quot;submit&quot; /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; //以上是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
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号