正在使用的是Laravel 5.2,我知道怎麼接收text,email, select, radio, textarea等,並把它們儲存到資料庫,但是不知道怎麼接收和儲存一組checkbox到資料庫。
比如下面這個例子:
{!! Form::open(array('url' => 'foo/bar')) !!} Email address We'll never share your email with anyone else. Password Example select 1 2 3 4 5 Example multiple select 1 2 3 4 5 Example textarea File input This is some placeholder block-level help text for the above input. It's a bit lighter and easily wraps to a new line. Option one is this and that—be sure to include why it's great Option two can be something else and selecting it will deselect option one Option three is disabled 1 2 3 Submit {!! Form::close() !!}
回複內容:
正在使用的是Laravel 5.2,我知道怎麼接收text,email, select, radio, textarea等,並把它們儲存到資料庫,但是不知道怎麼接收和儲存一組checkbox到資料庫。
比如下面這個例子:
{!! Form::open(array('url' => 'foo/bar')) !!} Email address We'll never share your email with anyone else. Password Example select 1 2 3 4 5 Example multiple select 1 2 3 4 5 Example textarea File input This is some placeholder block-level help text for the above input. It's a bit lighter and easily wraps to a new line. Option one is this and that—be sure to include why it's great Option two can be something else and selecting it will deselect option one Option three is disabled 1 2 3 Submit {!! Form::close() !!}
使用name=check[ ]
這樣接收的就是一個數組