表单提交后$ _post仍为空

时间:2016-02-05 12:28:25

标签: php forms intellij-idea

表单提交后,后超全局变量为空;然而,开始工作!

以下是代码:

的index.php

<!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Simple Form</title>
</head>
<body>
<fieldset>
    <form  action="print.php" method="POST" >
        first name:<input type="text" name="Fname"><br>
        last name:<input type="text" name="Lname"><br>
        <input type="submit" name="submit" value="submit">
    </form>
</fieldset>

</body>
</html>

print.php

<?php
echo $_POST['Fname'];
echo $_POST['Lname'];
?>

相同的代码在我的电脑上工作正常,print.php会打印一些东西,但是在我的Macbook上,$ _post在提交表单后总是为空。

我使用IntelliJ IDEA作为我的IDE与Php插件。

I use php 7

1 个答案:

答案 0 :(得分:3)

IntelliJ未映射到MAMP服务器。这就是为什么php被解释但POST不起作用的原因。为了将MAMP映射到IntelliJ,请使用适用于IntelliJ终极版和PhpStorm的this guide

相关问题