搜索结果作为指向php页面的链接


search results as links to a php page

为了解决这个问题,考虑ebay如何通过不太详细的相关拍卖表的名称和图像将搜索结果与拍卖的更详细描述联系起来。

我猜这需要名称和图像作为到新php页面的超链接,但我不确定如何通过超链接传递php变量,以便新php页面可以获取与单击的项目相关的详细信息。

到目前为止,我得到了如下的php脚本:

<tr class = "resultindex">
        <input type="hidden" value="<?php echo $ID; ?>" />
        <td class = "imgholder"><?php echo $img; ?></td>
        <td class = "infoholder">
            <div style ="height:4px;"></div>
            <div class = "infodiv"><?php echo $name; ?></div>
            <div class = "locdiv"></div>
            <div class = "userdiv"><span class="fromuser">From user: </span><br/><?php echo $owner; ?></div>
        </td>

其中php变量是从mysql数据库中提取的字段。我希望能够通过超链接传递隐藏的输入$ID,这样新的php页面就可以再次使用它作为引用从mysql中检索信息,并填充更详细的信息页面如何做到这一点?

您可以使用超链接和一些GET功能来实现您想要的功能,如下所示:

$id=4; // assume ID of some item you want to link to
$href="<a href='somePHPPage.php?myID=".$id."'>some text</a>";
echo $href; // will output the hyperlink in your page.

然后在页面中,您可以查询如下发送的数据:

$idYouWant=$_REQUEST['myID'];
// dp stuff with this variable to display the correct item...