I just would like to know more about session variables etc. as in, what is the best method to use when? Let me explain what I want to do.
If I enter information on "ADD" student details and press "ADD" button, then I go to a "COMMIT" page where I verify the user input and if successful, I proceed to add the record. If the user has made a mistake, I send them back to the input page and get them to correct their error.
1. Is it a good practice to set session variables of the user input fields so that the user does not need to re-enter the information? or
2. Is it better practice to send the input values back using href $_GET method? or, very different appraoch,
3. Should I be verifying input already on input screen before going to the commit page?
With the first method I send the user back to index.php once the add has taken place where I use session_destroy and session_unset at the top of the page to release those session variables, which works perfectly fine. I do realise that if I had not hard coded user login info in the config file, this method would no be ideal?
Registered: 13 years ago
yeah, I ended up using sessions for this as well, did some research and this seems to be the standard way to do it. Its called "sticky forms"
I also used sessions to send the error messages back to the form page. You can do the verification and database entry on the form page itself, which would eliminate the need to send the errors via session, but I started out with all my database action in one script page and I didnt want to change that.