繁体   English   中英

提交表单后如何将页面重定向到最后增加的ID

[英]how to redirect page to last incremented id after submitting form

这是我的代码}

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

您可以使用http://php.net/manual/en/pdo.lastinsertid.php

将此分配给$id ,您的脚本应按预期工作。

得到了解决方案

enter code here

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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