How to parse a value when using header( ) to redirect
Posted: Mon Jun 12, 2006 5:07 am
When a user submits a form, the submit function calls the current webpage.
If all of the fields in the form are filled in correctly, the data (using $_POST, $_GET etc) is inserted into a mysql database. Thing with this is that theres a few webpages which the user has to enter data into which relate to the same record within the mysql database.
1. Thus, when the data is inserted into the database from the FIRST webpage, is there any methods I can use which will return the id_number of the record which I have just created?? (As in the id number you put in yourself into mysql using auto_increment, primary_key etc).
I know if I can't do this, I can query the database with all the values I just entered into it, but the above would be much simpler and be 100% accurate rather than 99.99% accurate.
2. When I get this id_number from the database; I want to parse it on to the next webpage which is called using the header("location:next_page.php") function. THat way, when the user continues to fill out data required for the same record in the next webpage, I can "INSERT where id_number=<<id_number parsed from previous webpage>>".
I'm sure theres something simple and well known out there to do this (perhaps SOMEHOW using hidden html fields??) but I just have no idea what to even search for!!
Thanks.
If all of the fields in the form are filled in correctly, the data (using $_POST, $_GET etc) is inserted into a mysql database. Thing with this is that theres a few webpages which the user has to enter data into which relate to the same record within the mysql database.
1. Thus, when the data is inserted into the database from the FIRST webpage, is there any methods I can use which will return the id_number of the record which I have just created?? (As in the id number you put in yourself into mysql using auto_increment, primary_key etc).
I know if I can't do this, I can query the database with all the values I just entered into it, but the above would be much simpler and be 100% accurate rather than 99.99% accurate.
2. When I get this id_number from the database; I want to parse it on to the next webpage which is called using the header("location:next_page.php") function. THat way, when the user continues to fill out data required for the same record in the next webpage, I can "INSERT where id_number=<<id_number parsed from previous webpage>>".
I'm sure theres something simple and well known out there to do this (perhaps SOMEHOW using hidden html fields??) but I just have no idea what to even search for!!
Thanks.