parameter passing - [PHP ]How To Pass ID to other page? -
i want pass id other page can update data using id
i think i've coded wrong
$sql = "insert hotel (hotel_name, hotel_website, hotel_description, hotel_email, hotel_contact) values ('$hotel_name','$hotel_website','$hotel_desc','$hotel_email','$hotel_contact')"; mysqli_query($conn, $sql); ?> <script type="text/javascript"> alert("hotel information have been saved"); </script> <?php $result = mysqli_query($conn,"select hotel_id hotel"); $row = mysqli_fetch_assoc($result); $hotel_id = $row["hotel_id"]; echo '<script>window.location.href="property_add_address.php?id=".$hotel_id."</script>';
1st : no need select query .after insert query using mysqli_insert_id()
last inserted id , pass id next page .
$id=mysqli_insert_id($conn);
2nd : instead of window.location()
use header()
function in php .
header('location:property_add_address.php?id='.$id); exit();
3rd : access value in destination page .
echo $_get['id'];
Comments
Post a Comment