duansha7025 2013-12-25 19:09
浏览 28
已采纳

有人可以在我的代码中找到错误[关闭]

I have been looking for a mistake in my php and mysql for the past 5 hours. I have no clue what I have done wrong or if there is just a problem with my mamp. I think it may be a problem with my mamp. This is where I believe the problem would be taking place. Basically my goal with all of this was to make so when I click submit it displays the username and password that the user entered in the two fields. Thanks.

site/core/init.php

<?php
session_start();
error_reporting(0);

require 'database/connect.php';
require 'functions/users.php';

$errors = array();
?>

site/login

<?php
include 'core/init.php';
if(empty($_post) === false) {

$username = $_post['username'];
$password = $_post['password'];

echo $username, ' ', $password;

}
?>

site/core/database/users.php

NOTHING HERE YET

site/includes/widgets/logins

        <aside>         
            <div class = "rightsidebar">
                <h2>Log in/Register</h2>
                <form action = "login.php" method = "post">
                    <ul id = ".login">
                        <li>
                            Username:<br>
                            <input type = "text" name = "username">
                        </li>
                        <li>
                            Password:<br>
                            <input type = "password" name = "password">
                        </li>
                        <li>
                            <input type = "submit" value = "Log In">
                        </li>                                                       
                        <li>
                            <a href = "register.php"><p>Register</p></a>
                        </li>                       
                    </ul>
                </form>
            </div>
        </aside>

site/core/database/connect.php

  <?php
  mysql_connect('localhost', 'root', 'root');
  mysql_select_db('lr');



  ?>
  • 写回答

1条回答 默认 最新

  • drvc63490 2013-12-25 19:20
    关注

    Change your $_post with $_POST

    Also, in development environment, you better use error_reporting(E_ALL); than error_reporting(0); At least you will see what is going wrong.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型