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

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

报告相同问题?

悬赏问题

  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?