I'd like to combine two PHP files into one, but with two different forms and validation?

I have “index.php” which is a simple form (a checkbox that must be ticked to proceed) that, when submitted, loads my second PHP file “access.php”. The second file has a more complex form with some DB stuff and lots of validation.

To make things simpler, I’m trying to put everything in index.php so when you submit the checkbox form, it then loads the second form and code without the need for a second PHP file.

I’m sure this is possible, but my limited PHP skills prevent me from figuring it out.

Can anyone help? Thanks!

All this takes is some conditional logic (switch/case statements), to determine what action can be performed on the page and what will be displayed on the page.

How long does this checkbox value need to persist? One browser session? For as long as the visitor continues to come to the site?

One session. As soon as they check the box and submit, it loads the second page which collects an e-mail and checks for the existence of such in a DB…

Sponsor our Newsletter | Privacy Policy | Terms of Service