I'm trying to avoid a PHP script becoming too big and plan to create a file that will do some related tasks. My problem is that values submitted in a form are required in both and I'm not sure what the best approach to share data is.
After a user registers the form data is submitted to process.php which adds the data to the database and checks for duplicates. I'm now adding e-mail verification. I want everything to do with e-mail verification to be in it's own file, call it verify.php. Since both process.php and verify.php require data from the submitted form (e.g. username, e-mail address) what's the best way to share data? Here possible solutions I thought
- Have the form submit to both process.php and verify.php (not sure if this is possible)
- Have process.php include verify.php
- in PHP would this automatically include the variables $_GET and $_POST from process.php?
- After process.php finishes use a redirect header to go to verify.php and somehow pass it the form data
Generally speaking should including files be avoided?