$html_fields
$html_fields : string
Class FormBuilder.
Builds HTML form
__construct(string $target_url, string $method, string $class = null)
Sets attributes $target_url, $method and $class if not null
| string | $target_url | Page's URL that handles the form data |
| string | $method | The HTTP method to be used when submitting the form (GET or POST) |
| string | $class | The HTML class attribute name |
addInputHTML(string $id, string $label, string $type, string $name, string $value = '', string $attribute = '')
Adds an input field to the html_fields attribute
| string | $id | The input id attribute |
| string | $label | The element label |
| string | $type | The input type attribute |
| string | $name | The input name attribute |
| string | $value | The input default value |
| string | $attribute | Any other HTML attribute |
addTextareaHTML(string $id, string $label, string $type, string $name, string $rows, string $value = '', string $attribute = '')
Adds a textarea field to the html_fields attribute
| string | $id | The textarea id attribute |
| string | $label | The element label |
| string | $type | The textarea type attribute |
| string | $name | The textarea name attribute |
| string | $rows | The textarea rows number |
| string | $value | The textarea default value |
| string | $attribute | Any other HTML attribute |
addSelectHTML(string $id, string $label, string $name, array $options, string $selected = '')
Adds a select field to the html_fields attribute
| string | $id | The element id attribute |
| string | $label | The element label |
| string | $name | The element name attribute |
| array | $options | List of options |
| string | $selected | The default selected option |
addCheckboxHTML(string $id, string $label, string $type, string $name, string $class, string $attribute = '') : string
Creates an HTML checkbox field
| string | $id | The checkbox id attribute |
| string | $label | The checkbox label |
| string | $type | The checkbox type attribute |
| string | $name | The checkbox name attribute |
| string | $class | The HTML class attribute |
| string | $attribute | Any other HTML attribute |
An HTML checkbox field
addOneCheckboxHTML(string $id, string $label, string $type, string $name, string $class, string $attribute = '', string $main_label = '')
Adds a checkbox field to the html_fields attribute
| string | $id | The checkbox id attribute |
| string | $label | The checkbox label |
| string | $type | The checkbox type attribute |
| string | $name | The checkbox name attribute |
| string | $class | The HTML class attribute |
| string | $attribute | Any other HTML attribute |
| string | $main_label | The main element label |
addRadioHTML(string $id, string $main_label, string $type, array $radios, string $class, string $attribute = '')
Adds radios fields to the html_fields attribute
| string | $id | The radio id attribute |
| string | $main_label | The radio main label |
| string | $type | The radio type attribute |
| array | $radios | All radios name and label attribute |
| string | $class | The HTML class attribute |
| string | $attribute | Any other HTML attribute |