Welcome to the Cookbook

loading...

7.3.5.2 button

button(string $title, array $options = array())

Creates an HTML button with the specified title and a default type of "button". Setting $options['type'] will output one of the three possible button types:

  1. button: Creates a standard push button (the default).
  2. reset: Creates a form reset button.
  3. submit: Same as the $form->submit method.
<?php
echo $form->button('A Button');
echo $form->button('Another Button', array('type'=>'button'));
echo $form->button('Reset the Form', array('type'=>'reset'));
echo $form->button('Submit Form', array('type'=>'submit'));
?>
  1. <?php
  2. echo $form->button('A Button');
  3. echo $form->button('Another Button', array('type'=>'button'));
  4. echo $form->button('Reset the Form', array('type'=>'reset'));
  5. echo $form->button('Submit Form', array('type'=>'submit'));
  6. ?>

Will output:

<input type="button" value="A Button" />
<input type="button" value="Another Button" />
<input type="reset" value="Reset the Form" />
<input type="Submit" value="Submit Form" />