In CakePHP 1.3 you can create a form with multiple submit buttons:
echo $this->Form->submit(\'Submit 1\', array(\'name\'=>\'submit\');
echo $this->Fo
Don't use the same name for both submit buttons. Consider this example:
Form->create(false); ?>
Form->text('input'); ?>
Form->submit('Yes', array('name' => 'submit1')); ?>
Form->submit('No', array('name' => 'submit2')); ?>
Form->end(); ?>
debug($this->request->data) will produce the following when the "Yes" button is clicked:
array(
'submit1' => 'Yes',
'input' => 'test'
)
And here it is when the "No" button is clicked:
array(
'submit2' => 'No',
'input' => 'test'
)
To check which button was clicked:
if (isset($this->request->data['submit1'])) {
// yes button was clicked
} else if (isset($this->request->data['submit2'])) {
// no button was clicked
}