I'm encountering an error "htmlentities() expects parameter 1 to be string, array given", when I debug my code, this line from controller throwing the error.
return redirect()->back()->withErrors($validator)->withInput();
Controller
$rules = array(
'email' => 'required|email|unique:inspector_details', // required and must be unique in the ducks table
);
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
$messages = $validator->messages();
//return redirect()->back()->withErrors($validator)->withInput();
return redirect()->back()->withErrors($validator);
}
VIEW
{!! Form::open(array('route' => 'inspector.store','class' => 'form','id' => 'createinspector','name' => 'createinspector','files' => true)) !!}
<input type="hidden" name="_token" value="">
<input type="hidden" name="uid" id="uid" value="" />
<div class="col-md-6">
<div class="form-group">
<label>Name<span class="redmark"> *</span></label>
<input type="text" class="form-control" name="firstname" id="firstname" style="margin-bottom: 3px" value="" placeholder="Enter Name" required="required">
</div>
<div class="form-group">
<label>Email<span class="redmark"> *</span></label>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
<input type="email" class="form-control" name="email" id="email" placeholder="Email" value="" required="required">
</div>
<input type="checkbox" name="emailprivate" value="" id="emailprivate" style="margin-top: 3%"> <span style="font-weight : 100" >Keep email private.</span>
</div>
<div class="form-group">
<label>Zip Code<span class="redmark" id="zipvalidation" style="font-weight : 100;display: none"> Enter either 5 or 9 digits.</span></label>
<input type="text" class="form-control" name="zip" id="zip" onkeydown="validateNumber(event);" maxlength="9" value="" placeholder="Enter Zip Code">
</div>
<div class="form-group">
<label>Company<span class="redmark"> *</span></label>
<input type="text" class="form-control" name="company" id="company" value="" placeholder="Enter Company Name">
</div>
<div class="form-group">
<label>Website</label>
<input type="url" class="form-control" name="website" id="website" value="" placeholder="Enter Website url e.g http://www.google.com">
</div>
<div class="form-group">
<label>Phone Number</label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-phone"></i>
</div>
<input type="text" class="form-control" name="phone" id="phone" onkeydown="validateNumber(event);" value="" placeholder="Enter Phone number">
</div>
</div>
<div class="form-group">
<label>Free text</label>
<textarea class="form-control" rows="2" name="freetext" id="freetext" value="" placeholder="Enter Text"></textarea>
</div>
<div class="form-group">
<label for="exampleInputFile">Select logo</label>
{!! Form::file('logoimage', null) !!}
<p class="help-block"></p>
</div>
<!-- /.form-group -->
</div>
<!-- /.col -->
<div class="col-md-6">
<div class="form-group">
<label>Inspection Type</label>
<select class="form-control select2" name="inspectiontype[]" id="inspectiontype" value="" multiple="multiple" data-placeholder="Select Inspection Type" style="width: 100%;">
<option value="home" selected="selected">home</option>
<option value="roof">roof</option>
<option value="asbestos">asbestos</option>
<option value="lead">lead</option>
<option value="HVAC">HVAC</option>
<option value="pest">pest</option>
<option value="septic">septic</option>
<option value="environmental">environmental</option>
<option value="plumbing">plumbing</option>
<option value="zoning">zoning</option>
<option value="mold">mold</option>
<option value="wood destroyin g organisms (WDO)">wood destroying organisms (WDO)</option>
</select>
</div>
<div class="form-group">
<label>Company Begin Date:</label>
<div class="input-group date">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="form-control pull-right" name="companybegindate" id="companybegindate" value="" id="datepicker">
</div>
<!-- /.input group -->
</div>
<div class="form-group">
<label>street address 1<span class="redmark"> *</span></label>
<input type="text" class="form-control" name="residaddress1" id="residaddress1" value="" placeholder="Enter Street Address 1">
</div>
<div class="form-group">
<label>street address 2<span class="redmark"> *</span></label>
<input type="text" class="form-control" name="residaddress2" id="residaddress2" value="" placeholder="Enter Street Address 2">
</div>
<div class="form-group">
<label>City</label>
<input type="text" class="form-control" name="city" id="city" value="" placeholder="Enter City">
</div>
<div class="form-group">
<label>State<span class="redmark" id="statevalidation" style="font-weight : 100;display: none"> Enter two characters only e.g NJ</span></label>
<input type="text" class="form-control" name="state" id="state" value="" placeholder="Enter State e.g NJ">
</div>
<div class="form-group">
<label>Licensing:</label>
<input type="text" class="form-control" name="licname" id="licname" value="" style="margin-bottom: 2px" placeholder="Enter Licensing name">
<input type="text" class="form-control" name="licid" id="licid" style="margin-bottom: 2px" value="" placeholder="Enter Licensing ID">
<input type="text" class="form-control" name="licurl" id="licurl" style="margin-bottom: 2px" value="" placeholder="Enter URL to governing body">
</div>
<!-- /.form-group -->
</div>
<div class="col-md-12">
<div class="box-footer pull-left">
<button type="submit" class="btn btn-primary" onclick="return validate_data()">Create Inspector</button>
</div>
</div>
{!! Form::close() !!}
Any help is much appreciated..
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/28Vb7Gt
via IFTTT
Aucun commentaire:
Enregistrer un commentaire