简体   繁体   中英

how to redirect page to last incremented id after submitting form

here is my code }

        echo "<script type='text/javascript'>alert('Successfully Register!');</script>";
        echo "<script>document.location='detail.php?id=$id'</script>";

You can use http://php.net/manual/en/pdo.lastinsertid.php

Assign this to $id and your script should work as intended.

got the solution

enter code here

"header('Location: details.php?id=' . mysqli_insert_id($con)"

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