I want to place both register and login form on the same page.
They both starts with:
if (!empty($_POST)) ...
so, I need something like:
if (!empty($_POST_01))... // regForm
and
if (!empty($_POST_02))... //loginForm
Also how to prevent executing first form if the second is busy, and vice versa (user clicks on both)
My idea is to create a simple variable on starting process, for example $x = 1
and at the end of process $x = 0
, so:
if ((!empty($_POST_01)) And $x = 0)...
Probably, there is a better way.
Well you can have each form go to to a different page. (which is preferable)
Or have a different value for the a certain input and base posts on that:
You can use this easiest method.
Hope this will help you. Assumed that login form has: username and password inputs.
You could make two forms with 2 different actions
Or do this
Then you PHP file would work as a switch($_POST['action']) ... furthermore, they can't click on both links at the same time or make a simultaneous request, each submit is a separate request.
Your PHP would then go on with the switch logic or have different php files doing a login procedure then a registration procedure
Give the submit buttons for both forms different names and use PHP to check which button has submitted data.
Form one button - btn1 Form two button -btn2
PHP Code: