【问题标题】:Using PHP hyperlinks to extract data from mysql table使用 PHP 超链接从 mysql 表中提取数据
【发布时间】:2014-06-20 03:03:43
【问题描述】:

我目前被困在如何使用超链接中的 $_GET 并将其发送到另一个 php 页面进行处理。 我有 2 个 php 页面。第一个页面,我们称之为 page1.php,通过文本框从 HTML 页面获取用户输入 (customerID),并根据该 ID,进入数据库并使用以下方法查找相关信息,例如客户名称和地址等逻辑连接。

$id = $_GET['custID']; //This is to obtain the input from the HTML page.

我已经完美地工作了。

我的下一个任务是创建另一个 php 页面,我们将其命名为 page2.php,在该页面中我只需要输出 customerID 和 customerName,然后我需要在其中超链接 Customer ID 中的每条记录引用 page1.php 的行,当用户单击这些链接中的任何一个时,它应该只根据表中的该 customerID 显示信息。

到目前为止,我可以将客户 ID 行中的每条记录链接到 page1.php,但我无法输出任何结果。

<?php 
while ($row = mysql_fetch_array($rs)) { ?> 
<tr> 
<td><?php echo $row["customerName"]?></td> 
<td><?php echo "<a href='page1.php?'>{$row["custID"]}</a>"?></td> 
</tr> 
<?php } 

任何帮助将不胜感激。

【问题讨论】:

    标签: php html mysql sql hyperlink


    【解决方案1】:

    把链接改成关注

     <?php echo '<a href="page1.php?custID='.$row["custID"].'">'.$row["custID"].'</a>';?>
    

    【讨论】:

    • 那么你会有一个空的a 标签。点击什么?
    猜你喜欢
    • 2017-10-11
    • 1970-01-01
    • 1970-01-01
    • 2021-02-01
    • 2018-11-03
    • 1970-01-01
    • 2014-03-03
    • 1970-01-01
    • 2013-06-12
    相关资源
    最近更新 更多