doushi7394 2012-09-22 15:18
浏览 20
已采纳

如何在php中使用超链接显示数据[关闭]

I already display a list of names in a hyperlink format. When I click on one of the names, it does not display the data related to the name clicked. Can anyone help me..

<?php echo '<a href="nama.php?ID='.$rekod['nama'].'">'.$rekod['nama'].'</a>'; ?>

this code for student.php page

<?php     
   if(isset($_GET[$rekod['nama']]))
                {
                        $id = $_GET[$rekod['nama']];
                    if( $id!= NULL)
                    {
                        $query="SELECT matrik, kp_pass, nama, kod_prog, status
                            FROM _pelajar
                            WHERE nama = '$id'";
                        $qr=mysql_query($query);
        ?>

-this code for student.php page

  • 写回答

1条回答 默认 最新

  • 普通网友 2012-09-22 16:50
    关注

    It looks like you're almost there; you're just looking for the wrong variables:

    if (isset($_GET['ID'])) {
        $id = $_GET['ID'];                     
        if( $id!= NULL) {
        ....
    

    You're passing the variable in as ID, so you need to look for that in $_GET.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100