dongziche8030 2018-11-02 09:09
浏览 26

PHP表单操作(POST)不会发送到其他页面

I have an issue with my form.

Here's my form structure.

<form method="POST" action="../login.php">
  <input type="submit" name="login" value="test">
</form>

It's really only that.

But on my login page, it cannot get the POST parameter, and error logs says nothing.

<?php
if(isset($_POST['login']))
{
    echo "true";
}
else {
    echo "false";
}

^^ That's my php code, right there. I've also tried with

if($_SERVER['REQUEST_METHOD'] == "POST"){}

Instead of isset.

Can anyone see what i do wrong here??

Kind regards

  • 写回答

1条回答 默认 最新

  • duanpa1980 2018-11-02 12:05
    关注

    open login.php directly from URL and at the top of the code in login.php add the code given below.

    <?php
    echo "hello";die;
    ?>
    

    if you see the hello on the page that means your login.php working fine. but if you not that means your file is renamed incorrectly sometimes it happens by our editor. the file becomes like login.php.txt

    If the filename is correct and you are not getting hello then your server is not working.

    and it seems your code is also fine.

    You can also use POSTMAN to post data on your page without form and there is one more alternative ajax. ../login.php is the wrong path.

    if everything works fine then the error is 100% in the path.

    评论

报告相同问题?

悬赏问题

  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制