I'm new to laravel. I'm trying to insert multiple select values from listbox to a database table. This is the HTML of the select drop down I'm using:
<select name="tsubject[]" id="tsubject[]" multiple>
<option value="0">select</option>
<option value="English">English</option>
<option value="Malayalam">Malayalam</option>
<option value="Hindi">Hindi</option
<option value="Maths">Maths</option>
</select>
My controller.php is
else{
$teachers =new ForumTeacher();
$teachers ->tsubject=Input::get('tsubject[]');
}
The error that occurs is as follows;
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'tsubject' cannot be null (SQL: insert into `forum_teachers` (`tname`, `tmobile`, `ttype`, `tcls`, `tdivn`, `tsubject`, `updated_at`, `created_at`) values (NamithaP, 9876543211, normalteacher, 6, D, , 2015-02-12 09:09:16, 2015-02-12 09:09:16))