php - Laravel, html value '&' signs -
i have database types such as:
entertainment & food, health & care
etc.
i insert dropdown this:
<div class="form-group{{ $errors->has('type') ? ' has-error' : '' }}"> <div class="type_message form-control alert-warning" style="display: none;"></div> <label id="type2" for="type" class="col-md-4 control-label">type</label> <div class="col-md-6"> <select class="form-control" name="type" id="type"> <option selected value="{{ $entity->type }}">{{ $entity->type }}</option> @foreach ($entities $entity_select) <option value={{ $entity_select->type}}>{{ $entity_select->type }}</option> @endforeach </select> @if ($errors->has('type')) <span class="help-block"> <strong>{{ $errors->first('type') }}</strong> </span> @endif </div> </div> the problem when check value of field looks this:
<option value="entertainment & nightlife" selected="">entertainment & nightlife</option> therefore in database adds "entertainment" how can avoid that?
<option value="{!! $entity_select->type !!}">{!! $entity_select->type !!}</option> https://laravel.com/docs/5.4/blade#displaying-data
as mentionned in documentation :
be careful when echoing content supplied users of application. use escaped, double curly brace syntax prevent xss attacks when displaying user supplied data.
Comments
Post a Comment