I have a form where I insert a record and the ID (Primary key is Auto increment).
How I can show the ID in the next page after submit. I tried to echo mysql_insert_id(); in next page but didnt work:
<?php echo "Your refrence number is = ". mysql_insert_id(); ?>
Friend, Let’s see your issue this way. You have two pages A, and B. You insert data to the database in page A and get the last insert id with
mysql_insert_id();Now the issue is you want to use this in page B. I can propose you 4 ways. but I will explain you session base way since I think it is the best solution for you.Ok In your page A top of your page you write
session_start();remember it should be the first line. Once you get the last insert ID in page a you create a session variable.And in page B also you initiate the session as you did in page A. Then you can simply get the last ID using.
Hope you understand.