PHP获取数组值并保存它以显示在另一个页面中

PHP获取数组值并保存它以显示在另一个页面中,php,onclick,getvalue,Php,Onclick,Getvalue,我有一个显示数组数据的页面。当用户单击其中一张显示的图片时,我需要保存$row[“Rif”]的值,因为我需要在另一个页面中显示项目详细信息 我环顾四周,但似乎Jquery、Ajax是唯一可用的解决方案,但我不知道这些 有没有办法只用PHP实现它 谢谢大家! <?php if ($result->num_rows > 0) { // output data of each row while($

我有一个显示数组数据的页面。当用户单击其中一张显示的图片时,我需要保存$row[“Rif”]的值,因为我需要在另一个页面中显示项目详细信息

我环顾四周,但似乎Jquery、Ajax是唯一可用的解决方案,但我不知道这些

有没有办法只用PHP实现它

谢谢大家!

 <?php
          if ($result->num_rows > 0) {
                // output data of each row
                while($row = $result->fetch_assoc()) {
                    echo "<div class='col-md-3 col-sm-6 col-xs-12'>
                            <div class='property-container'>
                              <div class='property-image'>
                                <img src='img/img02.jpg' alt='test theme'>
                                <div class='property-price'>
                                  " . $row["DescCom"] . "<br>
                                  <span>" . "€ ". $row["Pre"] . " </span>
                                </div>
                                <div class='property-status'>
                                  <span>" . $row["Rif"] . "</span>
                                </div>
                              </div>
                              <div class='property-features'>
                                <span><i class='fa fa-home'></i> " . $row["Mq"] . " m<sup>2</sup></span>
                                <span><i class='fa fa-hdd-o'></i> " . $row["Cam"] . " Cam</span>
                                <span><i class='fa fa-male'></i> Piano " . $row["Pia"] . " </span>
                              </div>
                              <div class='property-content'>
                                <h3>" . $row["TIP"] . "<small>" . $row["Fra"] . "</small></h3>
                                <button type='submit' name='submit' class='btn btn-default btn-warning btn-xs pull-right btn-dettagli'>Details</button>
                              </div>
                            </div>
                          </div>";
                }
            } else {
                echo '0 results';
            }
            $conn->close();
        ?>

假设数据存储在
$row[“Rif”]


如果这是图像,您可以将其超链接到下一页,该页也将包含该id

<a href='next_page.php?id=". $row['Rif']."><img src='img/img02.jpg' alt='test theme'></a>


为什么不把产品的
id
带到下一页,然后在那里再次获取全部细节?嗨,Fakhruddin,while循环显示了许多结果。我如何知道带哪个id?我应该只带一个点击的,谢谢你能让它工作吗?嗨,谢谢,我觉得引号有问题,如果我这样离开它,它不工作,但即使我改为单引号,它也不工作,不知道如何将你的更改嵌入其中Thanks@ChrisA更新了我的答案。我错过了回声。让我知道它是否有效。嗨,刚刚尝试过,但它不起作用,问题是它不接受我们在标记中使用的双引号,因为它在回音中。如果我更改为单引号,它会在同一行上再次给我引号错误谢谢you@ChrisA很抱歉,我遗漏了您正在用PHP实现它。更正了答案。嗨,真管用!!抱歉打扰了,最后一个问题,这个值存储在哪里?我试着在“next_page.php”中回显$_GET['Rif'],但没有设置,非常感谢
<a href='next_page.php?id=". $row['Rif']."><img src='img/img02.jpg' alt='test theme'></a>