dongyong5255 2013-11-08 12:48
浏览 19
已采纳

无法从URL检索$ _POST值

I am working on a task and have set up my code as follows:
On index.php I include a file, which serves as a view with the code:

include 'Controller/CallArticleData.php';

$i = count($display) - 1;

while ($i >= 0) {
    echo "<a href='index.php?editID=" . $display[$i]['ID'] . "'>" . $display[$i]['title'] . "</a><br/>";
    $i--;
}  

Basically, I call the controller, which calls the relevant model and then I use the data to setup the URL - I want it to set $_POST['editID'] whenever a user clicks on the respective link.

However, the variable still remains unset upon hitting the link, even though the URL changes to index.php?editID=12345. I performed this check both in index.php and in the respective view.

What am I doing wrong?

  • 写回答

4条回答 默认 最新

  • doufu8588 2013-11-08 12:49
    关注

    You need to use $_GET to access querystring parameters:

    $_POST['editID']
    

    should be

    $_GET['editID']
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型
  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条
  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了