php
  • mysql
  • url-redirection
  • 2016-04-26 49 views 2 likes 
    2

    嘿傢伙,我有這樣的URL頁面重定向到頁面與選定的URL參數

    http://localhost/skripsi3/web/pesananwaiting.php?pilih=13 
    

    有表內的按鈕,這樣

    echo "<a href='considered.php?idorder=" . $row['id_order']."'><button type='button' class='btn btn-primary btn-default btn-sm'>Considered</button></a>"; 
    

    的代碼,如果我點擊該按鈕,它會重定向到.edp.php。要做到更新查詢,這是我considered.php

    <?php 
    session_start(); 
    include "connectdb.php"; 
    
    $idorder = $_GET["id"]; 
    $cons = "Considered"; 
    
    $query="UPDATE `preorder` SET `statuspesanan`='$cons' WHERE `id_order`='$_GET[idorder]'"; 
    $result = mysql_query($query); 
    header("Location:pesananwaiting.php"); 
    ?> 
    

    我的問題是如何使頭回來paramater到pesananwaiting.php這樣

    pesananwaiting.php?pilih=13 
    

    謝謝

    +0

    我只是想指出你的considered.php紙條很容易受到代碼注入。 –

    +0

    謝謝@AndreFerraz – Rei

    回答

    2

    您可以發送$_GET['pilih']連同$_GET['idorder']通過按鈕。

    echo "<a href='considered.php?idorder=" . $row['id_order'] . "&pilih=" . $_GET['pilih'] . "'><button type='button' class='btn btn-primary btn-default btn-sm'>Considered</button></a>"; 
    

    然後,在pesananwaiting.php呼應$_GET['pilih']

    header("Location:pesananwaiting.php?pilih=" . $_GET['pilih']); 
    
    +0

    嘿@luweiqi非常感謝你..它就像一個魅力! – Rei

    +0

    @Rei不客氣! – Panda

    相關問題