radio_box() table()

A group of radio buttons in each row, posting field[value] = the picked choice for every row.

table()->radio_box($name, $extra = [])

Options

OptionMeaning
valuesValue => label of the choices (required: without it the cells are empty).
selectedChoice checked in every row.
namePosted name; default the field name; [value] is appended unless it holds a [.
(html options)Every option of html()->radio_box(): horizontal, translate, class_add...

Example

Name Decision
Comment by anna
Comment by bohdan

Code

$rows = [
    1 => ['id' => 1, 'name' => 'Comment by anna'],
    2 => ['id' => 2, 'name' => 'Comment by bohdan'],
];
return table($rows, ['no_pages' => 1])
    ->text('name')
    ->radio_box('id', ['name' => 'moderate', 'values' => ['keep' => 'Keep', 'hide' => 'Hide'], 'selected' => 'keep', 'desc' => 'Decision'])
    ->footer_submit('Apply');

Notes

  • Here each row posts moderate[1], moderate[2]... with keep or hide.
  • It calls form().

See also: table/check_box, html/radio_box