View Full Version : Passing a Variable on Registration Page
kmlohr221718
03-06-2009, 10:44 AM
I used the Wizard on SecurityAssist to build my new registration page. What I need to be able to do is pass the just created unique id to the next page. I have done it using ASP, but not with PHP. Can someone tell me how to do this?
Ray Borduin
03-06-2009, 10:48 AM
Do you have DataAssist? Use DataAssist to do the insert and the newly inserted ID is automatically stored in the session for you.
In php you can access the newly inserted id on the page after it is inserted as: mysql_insert_id()
kmlohr221718
03-06-2009, 10:56 AM
Unfortunately, I have already built the pages around Security Assist and would hate to redo them. Where do I put the mysql_insert_id()? I am pretty new at PHP, so I need a just a little more details. Thanks.
Ray Borduin
03-06-2009, 11:06 AM
You wouldn't have to redo much... just remove the insert server behavior and apply the insert server behavior from DataAssist... the rest would still work.
If you want to add it, then somewhere in the code, after the insert takes place, add code like:
<?php
if (!session_id()) session_start();
if(!isset($_SESSION["NewID"])) {
$_SESSION["NewID"] = mysql_insert_id();
}
?>
then on the next page, or any page after, you could refer to that session variable for the last inserted id.
kmlohr221718
03-06-2009, 12:11 PM
Once again, you have saved me hours and hours of work. It's nice to know you are there!!!
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.