2

My blade.php code is:

{!! Form::input('text', 'tactic[]', null, array('id' => 'tactic', 'class' => ' form-control TabOnEnter', 'placeholder' => 'Tactics_1')) !!}

HtmlBuilder.php code is

public function escapeAll($value)
{
    return htmlentities($value, ENT_QUOTES, 'UTF-8');
}

The error message is:

ErrorException in HtmlBuilder.php line 65:
htmlentities() expects parameter 1 to be string, array given (View: /home/seyali-02/dev/htdocs/scam/resources/views/dashboard/Scam/edit.blade.php)

And i have changed the blade.php as like

{!! Form::input('text','', 'tactic[]', null, array('id' => 'tactic', 'class' => ' form-control TabOnEnter', 'placeholder' => 'Tactics_1')) !!}

and

{!! Form::text('name', 'tactic[]', null, array('id' => 'tactic', 'class' => ' form-control TabOnEnter', 'placeholder' => 'Tactics_1')) !!}

and also text('text', .. But nothing works for me and throwing me the same error as i mentioned above.. I have gone through all the similar questions related to this but none of those answers solved my problem . So please avoid doing duplication of this question and give me clear and correct solution..

1
  • what the value of $value variable? as i see this is an array. can you show us var_dump($value)? Commented Apr 26, 2017 at 6:44

2 Answers 2

2

You are adding tactic[] to the name which is an array and hence when you post the data it is going as an array. Either remove it or at php end use implode.

Sign up to request clarification or add additional context in comments.

4 Comments

Can you let me know how to make use of implode , because i am very beginner of php and laravel??
@ManiRaj Follow the link mentioned above.
Thanks, will check and let you know if i face any issues regarding it..
Here is a brief description @ManiRaj, Implode can take 2 parameters first is the Delimiter and Second parameter is the Array, and implode will simply join the elements of array to form one string. Eg. $array = ['a','b','c']; echo implode('-', $array); output will be a-b-c-d
1

If you want to take the input as an array then you can use this code

{!! Form::text('tactic[]',null,['id' => 'tactic', 'class' => ' form-control TabOnEnter', 'placeholder' => 'Tactics_1']) !!}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.