form_begin(), form_end() form()
The opening and closing form tags with their first fieldset; render() adds them itself unless you place them.
form()->form_begin($name = '', $method = '', $extra = [], $replace = [])
form()->form_end($extra = [], $replace = [])Options
| Option | Meaning |
|---|---|
$name, $method | Form name (default form_action, also the $replace key of its action) and method (default post). |
action, class, class_add, id, style, target, enctype, for_upload, novalidate, autocomplete | Attributes of <form>. |
fieldset, legend | Attributes of the first <fieldset>; its legend. |
Example
Code
return form([], ['no_form' => 1])
->form_begin('search', 'get', ['class' => 'form-inline', 'legend' => 'Search'])
->search('q', ['placeholder' => 'Find a product'])
->submit(['value' => 'Search'])
->form_end();Notes
- Outside the chain (
_class('form2')->form_begin()) they return the HTML at once. - On the user side a relative action goes through
process_url().
See also: form/form, form/fieldset