I've got a view in my Laravel app (4.2) that is for editing a database record.
I'm storing two values - colour and heading - as arrays using the form::text method:
@foreach($colours as $key => $value)
{{ Form::label('heading_' . $key,'Heading ' . ($key + 1)) }}
{{ Form::text('heading[]', '', ['id' => 'heading_' . $key, 'class' => 'u-full-width']) }}
{{ Form::label('colour_' . $key,'Colour ' . ($key + 1)) }}
{{ Form::text('colour[]', $value, ['id' => 'colour_' . $key, 'class' => 'u-full-width']) }}
@endforeach
The initial edit form is fine but if I experience an issue (for example a field being empty) when I return to the original view (through our controller) it throws the following error:
htmlentities() expects parameter 1 to be string, array given
Bizarrely, it works fine for the colour[] fields but seems to be throwing an error for the heading[] fields.
Any thoughts on why this might be happening?
Cheers
Cole