I am trying to create a single dynamic webpage with two separate forms:
- Sign in form
- Registration form.
This would mean one submit button for each form and clicking on one submit button should collect data from one form only. I tried the approach shown below but the data was not submitted to mySql database. I have tried running the forms individually and they do work with mysql database so I guess there should be something else wrong. The code below is stripped of details but I reckon the gist of it is inside. Thanks in advance!
<?php
if(isset($_POST['submit1']))
{
doSomething();
}
?>
<form id="form1" name="form1" action="" method="post">
...
<input type="submit" name="submit1" value="Sign in"/>
</form>
<?php
if(isset($_POST['submit2']))
{
doSomethngElse();
}
?>
<form id="form2" name="form2" action="" method="post">
...
<input type="submit" name="submit2" value="Sign up"/>
</form>
So I do like this:
Use 2 button with 1 name :