循环时使用PHP从表中发送和获取ID

循环时使用PHP从表中发送和获取ID,php,html-table,Php,Html Table,我需要你的帮助。 我有一些在循环时使用PHP的表 我需要关于如何从表中的选定行获取id,然后将其发送到另一个页面的帮助。我需要这样做,因为表不查看详细信息,所以我需要该ID来查看详细信息或从完整表中查询 下面是我的代码 <?php include('config.php'); session_start(); $table = "select * from rekuest"; $select = mysql_query($table); $user = $_SESSION['user

我需要你的帮助。 我有一些在循环时使用PHP的表 我需要关于如何从表中的选定行获取id,然后将其发送到另一个页面的帮助。我需要这样做,因为表不查看详细信息,所以我需要该ID来查看详细信息或从完整表中查询

下面是我的代码

<?php

include('config.php');
session_start();

$table = "select * from rekuest";
$select = mysql_query($table);

$user = $_SESSION['username'];
?>
<head>
        <title>Home</title>
        <link href="css/960.css" rel="stylesheet" media="screen" />
        <link href="css/defaultTheme.css" rel="stylesheet" media="screen" />
        <link href="css/myTheme.css" rel="stylesheet" media="screen" />
        <script src="js/jquery-1.6.1.js"></script>

    <script src="js/jquery.fixedheadertable.min.js"></script>
    <script src="js/demo.js"></script>

    <style type="text/css" media="screen"> 
        #tombol {
            display: block;
            width: 90px;
            height: 30px;
            background: url(img/tombol_normal2.png) no-repeat top;
        }
        #tombol:active {
            background: url(img/tombol_pressed.png) no-repeat bottom;
        }
    </style> 

</head>
<body>
<h1 align="center">List All Of Request</h1>
<h2 align="center">Welcome, <?php echo $_SESSION['username']; ?></h2>

<form>
    <input type="button" name="new" value="New Request" align="right"
    onClick="window.location='form.php'"/>
    <input type="button" onClick="window.location = 'logout.php?exit=yes'" class="myButton" value="Logout"/>

</form>
<div id="divider">
</div>

<table width="900" align="center" cellpadding="0" cellspacing="0" class="myTable04">
    <thead>
        <tr>
            <th>No Reff</th>
            <th>Subjek Request</th>
            <th width="20px">Permintaan</th>
            <th>Waktu</th>
            <th>Jenis Request</th>
            <th>Customer</th>
            <th>Sifat Requirement</th>
            <th>Pelaksana</th>
            <th>Status</th>
            <th>Respon</th>
            <th>Rekomen</th>
            <th>Nama File</th>
            <th>Attachment</th>
            <th>Detail</th>
        </tr>
    </thead>
    <tbody>
    <?php while($row = mysql_fetch_array($select)) { ?>
        <tr>
            <td><?php echo $row['id_rekuest']; ?></td>
            <td><?php echo $row['subjek']; ?></td>
            <td><?php echo $row['permintaan']; ?></td>
            <td><?php echo $row['waktu']; ?></td>
            <td><?php echo $row['jenis']; ?></td>
            <td><?php echo $row['customer']; ?></td>
            <td><?php echo $row['sifat']; ?></td>
            <td><?php echo $row['pelaksana']; ?></td>
            <td><?php echo $row['status']; ?></td>
            <td><?php  ?></td>
            <td><?php  ?></td>
            <td><?php  ?></td>
            <td><?php  ?></td>
            <td><a id="tombol" style="cursor:pointer" onClick="window.location='detail.php'"></a></td>
        </tr>

    <?php } ?>
    </tbody>
</table>

家
#汤博尔{
显示:块;
宽度:90px;
高度:30px;
背景:url(img/tombol_normal2.png)无重复顶部;
}
#tombol:活动的{
背景:url(img/tombol_pressed.png)无重复底部;
}
列出所有请求
欢迎
无参考文献
服从请求
佩尔曼丹
瓦克图
杰尼斯请求
顾客
Sifat要求
佩拉克萨纳
地位
响应
雷科曼
Nama文件
附件
细节
而不是

<td><a id="tombol" style="cursor:pointer" onClick="window.location='detail.php'"></a></td>


然后,在detail.php中,您可以从
$\u get['id']

获取id。我不知道您在问什么,但我认为您想要的是将id传递到详细信息页面。您可以通过以下get来完成此操作:

<td>
    <a id="tombol" style="cursor:pointer" href="detail.php?id=<?php echo $row['id_rekuest']; ?>"></a>
</td>


然后使用$_GET['id'](请消毒!)查询数据库中基于该id的任何内容

只是暂时搁置,而不是
,您也可以使用
。感谢您的帮助,非常感谢,这对我来说非常重要,因为我是php编程中的nubie谢谢alex,是的,您的答案完全正确,非常感谢你修复我的帖子。我非常喜欢这个论坛和php
<td>
    <a id="tombol" style="cursor:pointer" href="detail.php?id=<?php echo $row['id_rekuest']; ?>"></a>
</td>