【发布时间】:2016-03-15 22:55:17
【问题描述】:
我试图弄清楚如何在 POST 上获取 ?thread 的值。所以如果 ?thread=12;我想在提交帖子时返回该值,然后将其保存在变量中。
线程的价值
<?php foreach($threads as $thread) :?>
<td><a href = "?thread=<?php echo $thread['id'];?>">Thread Name</a></td>
<?php endforeach ; ?>
表格
<form action = "." method = "post">
<input type = "submit" value = "submit">
</form>
【问题讨论】:
-
要检索 GET 变量,您可以使用超全局变量
$_GET。因此,$thread = $_GET['thread'];要检索 POST 变量,请改用$_POST。