rranj
rranj

Reputation: 288

htmlentities() expects parameter 1 to be string, array given ..

my form code:

<p>{!!Form::open(array("","id"=>"form"))!!}</p>
<p>Initial barcode :&nbsp </p>
<p>{!! Form::text('initialbarcode',array("id"=>"initialbarcode"))!!}</p>
<p>Barcode3 :&nbsp </p>
<p>{!! Form::text('barcode3',array("id"=>"barcode3"))!!}</p>
<p>Quantity :&nbsp </p>
<p>{!! Form::text('qty',array("id"=>"qty"))!!}</p>
<p>Kgs :&nbsp </p>
<p>{!! Form::text('kgs',array("id"=>"kgs"))!!}</p>
<p>Price :&nbsp </p>
<p>{!! Form::text('price',array("id"=>"price"))!!}</p>
<p>{!! Form::text('name',array("id"=>"name"))!!}</p>
<p><select name="category" id="category"></p>
@foreach($options as $option)
<option>{{$option->category}}</option>
@endforeach
</select>
<p>{!! Form::close()!!}</p>

Here this code returns following error : htmlentities() expects parameter 1 to be string, array given (View: C:\Users\Toshiba\farmzop\resources\views\nonfz\nonfz.blade.php)

Upvotes: 1

Views: 1481

Answers (1)

Fiete
Fiete

Reputation: 1332

Please note the signature of the Form::text method:

/**
* Create a text input field.
*
* @param  string $name
* @param  string $value
* @param  array  $options
*
* @return string
*/
public function text($name, $value = null, $options = [])

Just change:

{!! Form::text('initialbarcode',array("id"=>"initialbarcode"))!!}

to

{!! Form::text('initialbarcode', null, ["id"=>"initialbarcode"]) !!}

Upvotes: 1

Related Questions