I have this two buttons,
<?php echo (($active_players >= 25 && !$active_players_check_bypass) ? $html->submit('Submit Registration', array('onclick'=>'return window.confirm("You have reached your maximum allowable players per team. In order to register this player, you must pay the $25.00 required overage fee in order to continue. Do you wish to continue with the registration?")')) : $html->submit('Submit Registration'));
echo $html->submit('Register Player using Registration Credits', array('id'=>'submitregistrationusingcredits')); // this will use the credits of the team
?>
The first button is Submit Registration and the other is Register Player using Registration Credits, now is there a way to know which button I clicked? Im using CakePHP and I am very new to this, is there a way to know which button I clicked so that when validating the form in my controller I will be able to tell what button I clicked and have a process which belongs to each button? Thanks.
I’m not intimately familiar with CakePHP’s HTMl or Form Helper (or whatever you’re using there). However I think if you add a name parameter in the second array argument:
Do that for both submit buttons. Then when you are handling that request you can write some code that will look like this:
You probably want to specify a name for both and check that each name is set. But that’s the idea.