I'm trying to create a form in CakePHP, in which there are 2 buttons: 'Accept' with value = 1, and 'Reject' 0. One button is generated with $this->Form->end()
and another with $this->Form->submit()
. On submission the value of field is_accept
in the database should be updated, with 0 or 1 depending on which button the user choose to click. But I'm not sure how to set the values for the buttons and also how to save the value to it.
The form:
echo $this->Form->create('Order');
$options = array(
'value' => '0',
'class' => 'btn btn-primary btn-lg pull-right'
);
echo $this->Form->submit('Reject', $options);
$options = array(
'label' => __('Accept'),
'class' => 'btn btn-primary btn-lg',
'value' => '1'
);
echo $this->Form->end($options);