【发布时间】:2016-05-27 06:59:07
【问题描述】:
我正忙于一个网页,以便能够回答问题。我有 2 页用 PHP 编写。
results.php:一个从数据库中获取所有行的while循环,包括。他们的身份证。每个问题都有自己的 ID。
<li><a href="answer.php?id=<?php echo $id;?>">Answer this question: </a></li>
reply.php:这会根据其 id 显示一个问题,但我不想在 $_POST 中显示 id,例如:reply.php?id=1。我试图通过将其放入会话中来隐藏 id,但这不起作用。 有人可以帮帮我吗?
<?php
if(isset($_POST['answer']))
{
$id = $_GET['id'];
/*
Each id that belongs to its question needs to changed when you click on another link it has to be looped.
Each time when we click on the answer link, we get the same id constantly but that is not our purpose.
I tried to give in the results.php file to give the id together with the url to avoid SQL Injections.
I placed the ids out of loops and placed it in session. Only the $_SESSION['vid'] stays the same even if I click on another answer link.
*/
}
【问题讨论】:
-
请发布一个 MCVE,向我们展示您的尝试。 stackoverflow.com/help/mcve
-
如果你使用 $_POST ,它不会显示 URL 中的数据,