简单表格PHP $ _POST不起作用 [英] Simple Form PHP $_POST not Working

查看:138
本文介绍了简单表格PHP $ _POST不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

/*loginform.php*/
<html lang="en">
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form method="post" action="login.php">
    <fieldset>
        <input name="email" type="text">
        <input name="password" type="text">
        <input type="submit">
    </fieldset>
</form>
</body>
</html>

试图将上面的html代码运行到下面的名为"login.php"的文件中,但是它没有从表单中提取任何POST数据,我没有理由.我觉得它的PhpStorm和XAMPP冲突,但是它们位于正确的文件路径〜/xampp/htdocs/folder中,而php.exe来自〜/xampp/php/php.exe,它已被PhpStorm识别.

我意识到我应该使用isset(),但我只是想弄清楚真正的问题是什么.

Trying to run the above html code into the below file named "login.php" but it is not pulling any POST data from the form, I have no reason why. I feel like its PhpStorm and XAMPP conflicting, but they are in the right file path ~/xampp/htdocs/folder and the php.exe is from ~/xampp/php/php.exe and it is recognized by PhpStorm.

I realize I should be using isset(), but I'm just trying to figure out what is the real issue.

/*login.php*/
<?php
echo $_POST['email'];
echo $_POST['password']; 
?>

输出:

注意:未定义索引:电子邮件输入 第2行上的C:\ Users \ danie \ Desktop \ xampp \ htdocs \ gclol \ login.php

注意:未定义索引:电子邮件输入 第3行的C:\ Users \ danie \ Desktop \ xampp \ htdocs \ gclol \ login.php

任何帮助将不胜感激.

Output:

Notice: Undefined index: email in C:\Users\danie\Desktop\xampp\htdocs\gclol\login.php on line 2

Notice: Undefined index: email in C:\Users\danie\Desktop\xampp\htdocs\gclol\login.php on line 3

Any help would be appreciated.

推荐答案

URL指示您正在使用内置在Web服务器中的PhpStorm(或其他IDE).

URL tells that you are using PhpStorm's (or other IDE's) built in web server.

如果要使用适当的Web服务器(例如Apache),请创建并配置Deployment条目,并将其标记为此项目的默认值-如果未指定部署(即IDE从中获取基本URL的位置),PhpStorm将使用-在Web服务器中.

If you want to use your proper web server (e.g. Apache) then please create and configure Deployment entry and mark it as Default for this project -- if no deployment specified (that's where IDE takes base URL from) PhpStorm will use built-in web server.

这就是我解决麻烦的方式.

That's the way I solved my trouble.

这篇关于简单表格PHP $ _POST不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆