I am trying to submit a form but it showed me "ErrorException Array to string conversion" in line generalForm::create($input);
public function store(Request $request)
{
$input = $request->all();
$input['services'] = $request->input('services');
$input['needs'] = $request->input('needs');
generalForm::create($input);
return redirect()->route('/');
}
when you use $input = $request->all();
, data is array and contain array of services, so you can store in directly if services filed exists on db and is array
generalForm::create($input);
return redirect()->route('/');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.