I have seen several instances of this question but did not get a clear answer. Here is my scenario
- I have a form on login.php - this should submit to loginController.php
- Once loginController.php validates against the databse, it should either redirect to home.php or pass back to login.php with appropriate success / error messages
- I know I can pass information back-forth between pages using
SESSION
but I would rather avoid using SESSION for just messages and objects that are page specific.
In JAVA we can embed objects into request
object and then forward the control to the next page. Is there something equivalent in PHP?
The way I am doing it at present is as below -
1.loginController.php has the main page and it includes login.php
2.login.php resubmits the data back to loginController.php (sorta recursive submit)
3.Then there is if-then-else logic to determine whether next redirect needs to go to home.php or just include login.php once again with error messages