form() table()

Wrap the table in a form, so inputs, check boxes and selects in its rows post together.

table()->form($action = '', $method = '', $extra = [])

Options

OptionMeaning
$actionForm action; default url('/@object/@action/@id'), this page.
$methodDefault POST.
forceReplace the form settings of an earlier call.

Example

Name Sort
Desk lamp
Office chair

Code

$rows = [
    1 => ['id' => 1, 'name' => 'Desk lamp', 'sort' => 10],
    2 => ['id' => 2, 'name' => 'Office chair', 'sort' => 20],
];
return table($rows, ['no_pages' => 1])
    ->form()
    ->check_box('id', ['desc' => ''])
    ->text('name')
    ->input('sort', ['class' => 'input-small'])
    ->footer_submit('Save order');

Notes

See also: table/footer_submit, demo:table/form