PHP Form post always empty

十年热恋 提交于 2020-01-03 03:09:08

问题


this must be configuration issue and I'm hoping somebody can help. I'm setting up a new project on my localhost and my PHP Post is always empty. Here's the example:

My Form Page:

<form id="loginForm" action="/post/login" method="post">
    <input type="text" name="username" />
    <input type="password" name="password" />
    <input type="submit" value="Submit" />
</form>

and the "/post/login/index.php" page:

<?php
var_dump( $_POST );
?>

the result:

array(0) { }

It seems like there's no code issue so what's the problem?


回答1:


The action attribute needs to point to the actual script of the page you want to go to.

Try doing this instead:

<form id="loginForm" action="/post/login/index.php" method="post">


来源:https://stackoverflow.com/questions/16306870/php-form-post-always-empty

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!