简体   繁体   中英

Laravel array inputs - htmlentities() expects parameter 1 to be string, array given

I get the following error whenever I sumbit the form having inputs as an array.

在此处输入图片说明

The problem only occurs when I submit the form.

this how my input array is :

在此处输入图片说明

It seems that you are passing the input as a type of array. htmlentities() only works on string type. This

<td><input type="text" name="type[]" value="{{ old('type') }}" class="form-control"></td>

Should be

<td><input type="text" name="type" value="{{ old('type.0') }}" class="form-control"></td>

The type.0 will return only the first item in the array.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM