douchui4815 2018-03-26 23:19
浏览 48
已采纳

php $ _POST不起作用,我得到空结果

I searched the other posts but non of the answers worked.
I tried to use $_REQUEST instead of $_POST, I tried to use if(isset($_POST['submit']) , I checked php.ini file and globals were enabled, I was using wamp server and I swiched between version 5 and 7, I removed wamp and Installed xampp but the result was the same (the result is empty page).

My code:

<form action="inbox.php?do=submit" method="post">
         <textarea name="sublinks" id="sublinks"></textarea>
        <input type="submit" value = "senď" />
</form>

<?
if($_GET['do'] == 'submit')
{
        echo $_POST['sublinks'];
}
?>

Edit: I tried this code and it works but I need to solve the problem Why echo $_POST not working

<?
    if($_GET['do'] == 'submit')
    {
    ?>
         <?=$_POST['links'];?>
    <?
    }
?>
  • 写回答

1条回答 默认 最新

  • dongyuan7110 2018-03-27 12:14
    关注

    I added php to <? and it works now, Thanks everyone :)

    <?php
    if($_GET['do'] == 'submit')
    {
            echo $_POST['sublinks'];
    }
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了