简体   繁体   中英

get id from previous page

Here is My Code now

SESSION_START();
if(isset($_POST['submit'])) {
include 'connection.php';
    $id             = $_POST['id'];
    $fullname       = $_POST['fullname'];
    $kategori       = $_POST['kategori'];
    $lokasi         = $_POST['lokasi'];
    $masaberlaku    = $_POST['masaberlaku'];
    $tipe           = $_POST['tipe'];
    $deskripsi      = $_POST['deskripsi'];
    $teknologi      = $_POST['teknologi'];


    mysql_query     ("UPDATE activity SET fullname ='$fullname' WHERE id_activity ='$id'" );
    mysql_query     ("UPDATE item INNER JOIN activity SET item.namaitem = activity.fullname WHERE activity.item_id = item.item_id") ;
    header("Location: modelingform.php?id=$id");
    }   

What I ask is, can i get the $id at the bottom being send to the next page?

so i get directed into modelingform.php?id=1

what i get now is modelingform.php?id=%201

You need to use urlencode() function for $id

Example:

header("Location: modelingform.php?id=".urlencode(trim($id)));

In urlencode() space encode with (+) , you also need to use trim() for removing spaces.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM