hi!
I think you should do another way.
Have a test at top of page
and if they are not logged in, send them to a login.php
if( !$loggedin ){
echo 'you have to login first. ';
echo '<a href='login.php'>login</a>';
exit();
}
// rest of your 'FORM 2' page
We often make the mistake of putting it all in same php page
.. or at least too much features in one page
This will make coding problematic, with numerous if(this and that) nested testings.
When I look at some experienced coders php pages
it sometimes make me surprised how little and simple code they need.
I have seen horrible examples, when complete website CMS was only in one 'index.php'.
Think I never have seen more messed up, uncomprehendable and complicated php programming 😃 😃
I prefer use many pages. With little code in each.
Using links and/or includes to put it all together.
Regards 🙂