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 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀