我尝试使用$_POST
从表单中获取数据,但它始终返回错误
PHP Notice: Undefined index:
我尝试了一切使它工作,但它没有工作??? 这是我的PHP代码
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_POST["username"])){
$username = $_POST['username'];
echo $username;
}
if (isset($_POST["username"])){
$password = $_POST['password'];}}
这是表格
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>">
<input type="text" placeholder="Username" name="username" id="username" required="required"/>
<input type="password" name="password" placeholder="Password" id="password" required="required"/>
<button type="submit" class="btn btn-primary btn-block btn-large" name="submit">Let me
in.
</button>
</form>
我使用if条件来解决未定义的索引问题,但我仍然无法从我的表单中获取数据
我使用的是phpstorm和Ampps apache 我确定从我的代码,但我不确定我的PHP配置问题在哪里
我在php.ini上做了一些修改来安装XDabug,但我不记得我改变的事情