doutu9810 2018-05-13 18:08 采纳率: 0%
浏览 14
已采纳

试图通过php中的页面链接传递值[重复]

This question already has an answer here:

I am trying to pass value with page link to another page,but the other page is receiving the variable directly not its value.

sender page code

`

<?php 
    if(isset($_POST["view"])){
        $connect = mysqli_connect("localhost","root","","ajmal");

        $Email = $_POST["email"];

        if ($_POST['view'] != '') {
            $update_query = "UPDATE notification SET confirm_ststus=1 WHERE 
            confirm_to='$Email'";
            mysqli_query($connect,$update_query);
        }

        $response='';
        $query="SELECT * FROM notification WHERE confirm_to='$Email' ORDER 
        BY confirm_id DESC LIMIT 5";
        $result=mysqli_query($connect,$query);
        if(mysqli_num_rows($result) > 0){
            while ($row=mysqli_fetch_array($result)) {
                $orderID=$row["orderID"];
                $response.='
                <li>
                    <a href="cusDealerPDF.php?orderID=$orderID">
                        <strong>From : '.$row["confirm_from"].'</strong> 
                       <br/>
                        <small><em>'.$row["confirm_text"].'</em></small>
                    </a>
                </li>
                ';
             }
         }else{
            $response.='<li><a href="" class="text-bold text-italic">No 
           Notification Found</a></li>';
        }
        $query_1 = "SELECT * FROM notification WHERE confirm_ststus=0 AND 
        confirm_to='$Email'";
        $result_1 = mysqli_query($connect,$query_1);
        $count = mysqli_num_rows($result_1);
        $data = array(
            'notification'          => $response,
            'unseen_notification'   => $count
        );
        echo json_encode($data);
    }

`

Receiver page code `

<?php
    if (isset($_GET['orderID'])) {
        echo $_GET['orderID'];
    }
?>

`

at line <a href="cusDealerPDF.php?orderID=$orderID"> I am trying to send value containing by a variable $orderID.The receiver page should print the value contained by variable $orderId but it is directly printing the variable $orderID..what to do?

</div>
  • 写回答

1条回答 默认 最新

  • douzhong1730 2018-05-13 18:11
    关注

    Just switch the quotes:

    $response.="
    <li>
        <a href='cusDealerPDF.php?orderID=$orderID'>
            <strong>From : ".$row["confirm_from"]."</strong> 
            <br/>
            <small><em>".$row["confirm_text"]."</em></small>
        </a>
    </li>
    ";
    

    Learn the difference between Single & Double quotes and other ways too

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

报告相同问题?

悬赏问题

  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥15 树莓派5怎么用camera module 3啊
  • ¥20 java在应用程序里获取不到扬声器设备
  • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗