How to escape html for Laravel

I have a question on it, so this is my output enter image description here

and this is my index.blade.php code

  <tr>
                    <td>{{$row['policy_category_id']}}</td>
                    <td>{{$row['policy_title']}}</td>
                    <td>{{$row['version_no']}}</td>
                    <td>{{$row['policy_details']}}
                    <td>{{$row['expiry_date']}}</td>
                    <td>{{$row['file_path']}}</td>

                    <td><a href="{{action('policyController@edit', $row['id'])}}" class="btn btn-warning">Edit</a></td>
                    <td>
                        <form method="post" class="delete_form" action="{{action('policyController@destroy',$row['id'])}}">
                            {{  csrf_field()    }}
                            {{  method_field('DELETE')}}

                            <input type="hidden" name="_method" value="DELETE"  />
                            <button type="submit" class="btn btn-danger">Delete</button>
                        </form>

My question is how to remove those label away but just showing human readable data ? Thanks for helping me

Upvotes: 0

Views: 341

Answers (1)

rattybag
rattybag

Reputation: 421

You can use the strip_tags function (https://www.php.net/manual/en/function.strip-tags.php):

  <tr>
                <td>{{$row['policy_category_id']}}</td>
                <td>{{$row['policy_title']}}</td>
                <td>{{$row['version_no']}}</td>
                <td>{{strip_tags($row['policy_details'])}}
                <td>{{$row['expiry_date']}}</td>
                <td>{{$row['file_path']}}</td>

                <td><a href="{{action('policyController@edit', $row['id'])}}" class="btn btn-warning">Edit</a></td>
                <td>
                    <form method="post" class="delete_form" action="{{action('policyController@destroy',$row['id'])}}">
                        {{  csrf_field()    }}
                        {{  method_field('DELETE')}}

                        <input type="hidden" name="_method" value="DELETE"  />
                        <button type="submit" class="btn btn-danger">Delete</button>
                    </form>

Upvotes: 1

Related Questions