简体   繁体   English

指向同一页面的多个链接,但具有不同的信息

[英]Multiple links to the same page but with different information on it

I have a table which is created 'on the fly' from a database using the following code: 我有一个使用以下代码从数据库中“动态”创建的表:

    <tr>
      <td><?php echo $row_buyerdetails['time_stamp']; ?></td>
      <td><?php echo $row_buyerdetails['title']; ?></td>
      <td><?php echo $row_buyerdetails['first_name']; ?></td>
      <td><?php echo $row_buyerdetails['surname']; ?></td>
      <td><?php echo $row_buyerdetails['email_address']; ?></td>
      <td><?php echo $row_buyerdetails['phone_number']; ?></td>
      <td><?php echo $row_buyerdetails['house']; ?></td>
      <td><?php echo $row_buyerdetails['street']; ?></td>
      <td><?php echo $row_buyerdetails['town']; ?></td>
      <td><?php echo $row_buyerdetails['city']; ?></td>
      <td><?php echo $row_buyerdetails['postcode']; ?></td>
      <td>**LINK IN HERE**</td>
    </tr>
    <?php } while ($row_buyerdetails = mysql_fetch_assoc($result)); ?>
  </table>

The code produces a table with the buyers basic details in it as shown below: 该代码生成一个表,其中包含买家的基本详细信息,如下所示:

在此输入图像描述

In the cells with the text "LINK IN HERE" I want a link to a page called buyerdetails.php which will show all the information about that person. 在文本“LINK IN HERE”的单元格中,我想要一个名为buyerdetails.php的页面链接,该页面将显示有关该人的所有信息。 How do I create the link so that it passes an identifying value to the page buyersdetails.php so that page knows which users details to look up in the database and display them? 如何创建链接以便将标识值传递给页面buyerdetails.php,以便页面知道在数据库中查找哪些用户详细信息并显示它们?

Assuming each buyer detail has a unique identifier (we'll use an integer id for this example), something like this should suffice 假设每个买家详细信息都有一个唯一的标识符(我们将在这个例子中使用整数id ),这样的东西就足够了

<td>
    <a href="buyerdetails.php?id=<?= (int) $row_buyerdetails['id'] ?>">More Details</a>
</td>

On buyerdetails.php , you can then retrieve the value via $_GET['id'] . buyerdetails.php ,您可以通过$_GET['id']检索该值。

Pass it as a url parameter.. 将其作为url参数传递给..

<a href="buyersdetails.php?buyerid=<?php echo $row_buyerdetails['id'];?>">LINK HERE</a>

and in that page use $buyerid = $_GET['buyerid']; 并在该页面中使用$buyerid = $_GET['buyerid']; and use it in your query 并在您的查询中使用它

Easy example is that you create link with GET parameter - like buyersdetails?id=X 简单的例子是你用GET参数创建链接 - 比如buyerdetails?id = X.

X = ID of clicked user. X =已点击用户的ID。 and than at buyerdetails.php add some SQL statement which gets all data from database with id = X 而且在buyerdetails.php中添加了一些SQL语句,它从id = X的数据库中获取所有数据

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 同一页面上的多个链接不起作用 - Same page multiple links not working 我想在同一页面中显示来自不同链接的内容 - I'd like to display content from different links in the same page 如何在 HTML 中创建指向同一页面(但不同选项卡)上部分的链接 - How to create links to sections on the same page (but different tab) in HTML 如何使用传递不同ID的相同敲除功能绑定多个链接 - How to bind multiple links with same knockout function passing different IDs HTML在同一新窗口中打开页面上的多个链接 - Html opening multiple links on the page in a same new window 为灯箱中同一页面上的多个链接制作单独的图库 - Help with making a seperate gallery for multiple links on same page in lightbox 如何使该Javascript与同一页面上的多个链接一起使用? - How can I get this Javascript to work with multiple links on the same page? 想要在同一页面上使用不同数据的多个图表 - Want to multiple charts on same page with different data 同一页面上多个 nivo slider 的不同延迟 - Different delay for multiple nivo slider on same page 通过PHP的同一页面上的不同链接从数组传递不同的值 - Passing different values from an array through different links on the same page in PHP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM