form_button([$data = ''[, $content = ''[, $extra = '']]])
| Parameters: |
|
|---|---|
| Returns: |
An HTML button tag |
| Return type: |
string |
Lets you generate a standard button element. You can minimally pass the button name and content in the first and second parameter:
echo form_button('name','content');
// Would produce: <button name="name" type="button">Content</button>
Or you can pass an associative array containing any data you wish your form to contain:
$data = array(
'name' => 'button',
'id' => 'button',
'value' => 'true',
'type' => 'reset',
'content' => 'Reset'
);
echo form_button($data);
// Would produce: <button name="button" id="button" value="true" type="reset">Reset</button>
If you would like your form to contain some additional data, like JavaScript, you can pass it as a string in the third parameter:
$js = 'onClick="some_function()"';
echo form_button('mybutton', 'Click Me', $js);
Please login to continue.