htmlspecialchars() expects parameter 1 to be string array given

htmlspecialchars() expects parameter 1 to be string, array given yii2
htmlspecialchars expects parameter 1 to be string array given vi
htmlspecialchars expects parameter 1 to be string, array given vue
basename expects parameter 1 to be string, array given laravel
warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain
json_decode() expects parameter 1 to be string, array given
ucfirst expects parameter 1 to be string object given
htmlspecialchars() expects parameter 1 to be string object given json_decode

I have an input field in which I am passing an array from my controller as hidden input but its giving me this error of array given.

Code of my view is

    <input type="hidden" name="DiseaseDiagnosed[]" value="{{$DiseaseDiagnosed}}">

Code of controller passing the value to view is

 return view('/doctorPanel/diagnoseDisease', ['chart' => $chart, 'patient' => $patient, 'symptomsStated' => $symptomsStated, 'DiseaseDiagnosed' => $DiseaseDiagnosed]);

Kindly tell me why I am getting this error

<input type="hidden" name="DiseaseDiagnosed[]" value="{!! jsond_encode($DiseaseDiagnosed) !!}">

Actually, your input is DiseaseDiagnosed is an array which is returned to view.

So you have to use {{ json_decode($DiseaseDiagnosed) }}

You can also try

@foreach($DiseaseDiagnosed as $disease)

  <input type="hidden" name="DiseaseDiagnosed[]" value="{{ $disease }}">

@endforeach

htmlspecialchars() expects parameter 1 to be string, array given, htmlspecialchars() expects parameter 1 to be string, array given. Its pointless anyway, you cannot pass value= into a select form element. htmlspecialchars() expects parameter 1 to be string, array given – Kiddo Apr 4 '17 at 21:34

Blade Template engine is producing this error. you can't print array like this using {{ }}. When passing this value, you can encode it using 'DiseaseDiagnosed'=>json_encode($DiseaseDiagnosed]), then you can use that syntax. After that when you want to use this value, don't forget to decode it using json_decode()

htmlspecialchars() expects parameter 1 to be string, object given, htmlspecialchars() expects parameter 1 to be string, object given. Posted 11 months ago by yafeearun. Hi guys i have tried to send a mail and i write a mailable  htmlspecialchars() expects parameter 1 to be string, object given - laravel. 2. htmlspecialchars() expects parameter 1 to be string, array given in Laravel. 0.

In order to create an array with inputs you need to have 1 input for each value inside the array. You are appending an array on the value when it only accepts Strings so thats why it warns you that an array was given when a String was expected.

As @Adnan suggested you can solve this using:

@foreach($DiseaseDiagnosed as $disease)

   <input type="hidden" name="DiseaseDiagnosed[]" value="{{ $disease }}">

@endforeach

Then in your controller you will recieve the array DiseaseDiagnosed with all the values you inserted, eg: You will recieve all the values within the same array->

dd($request->DiseaseDiagnosed);
// You will see this is an array with all the values

Error: htmlspecialchars() expects parameter 1 to be string, array , Error: htmlspecialchars() expects parameter 1 to be string, array given #85. Closed. soyjonathanespinosa opened this issue on Sep 21, 2018 · 2 comments. htmlspecialchars() expects parameter 1 to be string, array given (View: Is there a collection method that i could use and sort this out or what whould be the way to get what i achieved in tinker

Translation error: htmlspecialchars() expects parameter 1 to be , Translation error: htmlspecialchars() expects parameter 1 to be string, array given #26664. Closed. applyACS opened this issue on Nov 29,  login.php warning : htmlspecialchars() expects parameter 1 to be string, array given. Subscribe: RSS. htmlspecialchars() expects parameter 1 to be string, array given

htmlspecialchars() expects parameter 1 to be string, object given in , Warning: htmlspecialchars() expects parameter 1 to be string, object given in krumo::_array() (line 1083 of /sites/all/modules/devel/krumo/class. Issue: htmlspecialchars() expects parameter 1 to be string, array given. Description: While in the admin panel, (in admin/orders.php) orders show as line items fine. although when you click on the edit button, invoice button or packing slip button I receive the following:

Laravel – htmlspecialchars() expects parameter 1 to be string, object , Laravel – htmlspecialchars() expects parameter 1 to be string, object given. 0. I go this error: htmlspecialchars() expects parameter 1 to be string, array given Posted 1 year ago by nero. expects parameter 1 to be string, array given (View: