I’m looking to implement a Booking system that will involve the user completing a number of steps.
How would I manage user input between these steps? I don’t want to be adding the information supplied on each step to a database in case that the user doesn’t complete the steps.
So I need a way of persisting data entered between page redirects and then submit that data at once to the database.
I was thinking maybe a Session array? Or maybe even MySQL using prepared statements?
I’m not sure the best way of doing this.
Thanks.
You should store everything in
$_SESSION, and insert that data into the database (or do whatever else you want with it) at the last submission stage.Just remember to put
session_start()at the top of each page, or you’ll get a load ofUndefinederrors.Of course, you could use a database, but it’s extra hassle – store temporary data temporarily, and then make it persistent with a database.