I have two submit button in my webpage. Once a button is clicked (using post method), it will do perform different action.
How do I check which of the two button is clicked by the user?
The code for the two button
<form name="existingForm" method="post" action="">
<div class="alert alert-info" role="alert" style="text-align: center;">
<label>Are you a returning customer?</label>
<input name="button1" type="submit" value="Login Here" />
</div>
</form>
<form name="logingForm" method="post" action="">
<div class="alert alert-info" role="alert" style="text-align: center;">
<label>Are you a returning customer?</label>
<input name="button2" type="submit" value="Login Here" />
</div>
</form>
The code for post method for button 1:
if($_SERVER["REQUEST_METHOD"] == "POST")
{
$buttonPressed = 1;
}
The code for post method for button 2:
if($_SERVER["REQUEST_METHOD"] == "POST")
{
$buttonPressed -= 1;
}