This is my edit method:
public function edit(User $user)
{
// ...
return view('admin.biodata.edit',
[
'title' => 'Edit Biodata',
'active' => 'biodata',
'majors' => Major::all(),
'biodata' => $user
]
);
}
edit.blade.php
#extends('admin.adminDashboard.layouts.main')
#section('container')
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2"></div>
<h1>Edit Student</h1>
<div class="container">
<form action="{{url('admin/biodata')}}" method="POST">
#csrf
<input type="hidden" name="id" value="{{ $biodata->id }}">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name" name="name" placeholder="Enter name" value="{{$biodata->name}}">
</div>
<div class="form-group">
<label for="nrp">NRP</label>
<input type="text" class="form-control" id="nrp" name="nrp" placeholder="Enter NRP" value="{{$biodata->nrp}}">
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" name="email" placeholder="Enter email" value="{{$biodata->email}}">
</div>
<div class="form-group">
<label for="address">Address</label>
<input type="text" class="form-control" id="address" name="address" placeholder="Enter address" value="{{$biodata->address}}">
</div>
<div class="form-group">
<label for="generation">Generation</label>
<input type="text" class="form-control" id="generation" name="generation" placeholder="Enter generation" value="{{$biodata->generation}}">
</div>
<div class="form-group">
<label for="major">Major</label>
<select class="form-control" id="major" name="major_id">
#foreach ($majors as $major)
<option value="{{$major->id}}">{{$major->nama_jurusan}}</option>
#endforeach
</select>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
#endsection
When I press the edit button from the index view, the old data is not displayed in the view admin.biodata.edit. I thought I have already passed the user data through the biodata variable.
Replace the value in the template with
value="{{old('name',$biodata->name)}}"
Related
I want to update the record of the corresponding id that is sent on clicking save button. I tried button tage, input tage and link tage but there is some mistake that I am making, but I don't know where?
This is my form
<form method="POST" action="handle_update.php">
<div class="mb-3">
<label for="exampleInputEmail1" class="form-label">First name</label>
<input type="text" name="fname" value="'.$first_name.'" class="form-control" >
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Last name</label>
<input type="text" name="last_name" value="'.$last_name.'" class="form-control">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Email</label>
<input type="email" name="email" value="'.$email.'" class="form-control">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Designation</label>
<input type="text" name="designation" value="'.$designation.'" class="form-control">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Address</label>
<input type="address" name="address" value="'.$address.'" class="form-control">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Date of Joining</label>
<input type="date" name="joining_date" value="'.$joining_date.'" class="form-control">
</div>
<a name="update" role = "button" type="submit" href="handle_update.php?ployee_id='.$id2.'">Save</a>
</form>
Add a hidden input field that holds the value you want to submit. Change your <a> to a <button> that can submit your form. Change your code to:
<form method="POST" action="handle_update.php">
<input type="hidden" name="ployee_id" value="' . $id2 . '">
<div class="mb-3">
<label for="exampleInputEmail1" class="form-label">First name</label>
<input type="text" name="fname" value="'.$first_name.'" class="form-control" >
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Last name</label>
<input type="text" name="last_name" value="'.$last_name.'" class="form-control">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Email</label>
<input type="email" name="email" value="'.$email.'" class="form-control">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Designation</label>
<input type="text" name="designation" value="'.$designation.'" class="form-control">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Address</label>
<input type="address" name="address" value="'.$address.'" class="form-control">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Date of Joining</label>
<input type="date" name="joining_date" value="'.$joining_date.'" class="form-control">
</div>
<button type="submit" name="update">Save</button>
</form>
More on forms: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form
More on hidden inputs: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/hidden
For my website, when this particular page is clicked I want the form to be populated with data from the database. Here is the code for the form:
<form class="form-horizontal" role="form" method="post" action="{{url('/company-profile/update')}}">
{{ csrf_field() }}
#foreach($getAllDetails as $list)
<div class="form-group">
<div class="col-sm-10">
<label for="companyname" class="control-label">Company Name</label>
<input type="text" class="form-control" id="companyname" name="companyname" placeholder="Enter Company Name" value={{$list->companyName}}>
</div>
</div>
<div class="form-group">
<div class="col-xs-5 col-sm-4 col-md-3">
<label for="shortCode" class="control-label">Short Code</label>
<input class="form-control" id="shortCode" name="shortCode" placeholder="Short Code" value={{$list->shortCode}}>
</div>
<div class="col-xs-7 col-sm-6 col-md-7">
<label for="telnum" class="control-label">Telephone Number</label>
<input type="tel" class="form-control" id="telnum" name="telnum" placeholder="Tel. number" value={{$list->phoneNo}}>
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
<label for="emailid" class="control-label">Email</label>
<input type="email" class="form-control" id="emailid" name="emailid" placeholder="Email" value={{$list->emailAddress}}>
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
<label for="logoPath" class="control-label">Logo Path</label>
<input type="" class="form-control" id="logoPath" name="logoPath" placeholder="Enter Logo Path" value={{$list->logoPath}}>
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
<label for="feedback" class="control-label">Contact Address</label>
<textarea class="form-control" id="address" name="address" rows="2" value={{$list->contactAddress}}></textarea>
</div>
</div>
#endforeach
<div class="form-group">
<div class="col-sm-10">
<button type="submit" class="btn btn-success">Submit</button>
</div>
</div>
</form>
This issue is:
For example, if I want to fetch the company name {{$list->companyName}} only the first word gets displayed. For example, If the company's name is National Film Institute, only National gets displayed.
Here is code the for my index function in the controller:
public function index()
{
$data['getAllDetails']= DB::table('tblcompany')->get();
return view('companyProfile.companyProfile', $data);
}
Change
value={{$list->your_field}}
to
value="{{$list->your_field}}"
i add a new table using the voyager database menu. the problem is that i can't create new data with my newly created database... anytime i try to insert a new data, its only the created_at and Updated_at column that is populated
and the code:
<form clas[s="form-edit-add" role="form"][1]
action="#if(isset($dataTypeContent->id)){{
route('voyager.'.$dataType->slug.'.update', $dataTypeContent->id) }}#else{{
route('voyager.'.$dataType->slug.'.store') }}#endif"
method="POST" enctype="multipart/form-data">
<!-- PUT Method if we are editing -->
#if(isset($dataTypeContent->id))
{{ method_field("PUT") }}
#endif
<!-- CSRF TOKEN -->
{{ csrf_field() }}
<div class="panel-body">
<div class="form-group">
<label for="name">Staff_id</label>
<input type="text" class="form-control"
name="Staff_id"
placeholder="Staff_id" id="Staff_id"
value="#if(isset($dataTypeContent-
>Staff_id)){{ old('Staff_id', $dataTypeContent->Staff_id)
}}#else{{old('Staff_id')}}#endif">
</div>
<div class="form-group">
<label for="name">Title</label>
<input type="text" class="form-control"
name="title"
placeholder="title" id="title"
value="#if(isset($dataTypeContent-
>title)){{ old('title', $dataTypeContent->title)
}}#else{{old('title')}}#endif">
</div>
div class="form-group">
<label for="name">First_Name</label>
<input type="text" class="form-control"
name="first_name"
placeholder="first_name" id="first_name"
value="#if(isset($dataTypeContent-
>first_name)){{ old('first_name', $dataTypeContent->first_name)
}}#else{{old('first_name')}}#endif">
</div>
<div class="form-group">
<label for="name">Middle_Name</label>
<input type="text" class="form-control"
name="middle_name"
placeholder="middle_Name"
id="middle_name"
value="#if(isset($dataTypeContent-
>middle_name)){{ old('middle_name', $dataTypeContent->middle_name)
}}#else{{old('middle_name')}}#endif">
</div>
<div class="form-group">
<label for="name">Last_Name</label>
<input type="text" class="form-control"
name="last_name"
placeholder="Last_Name" id="last_name"
value="#if(isset($dataTypeContent-
>last_name)){{ old('last_name', $dataTypeContent->last_name)
}}#else{{old('last_name')}}#endif">
</div>
<div class="form-group">
<label for="name">Gender</label>
<input type="text" class="form-control"
name="gender"
placeholder="gender" id="gender"
value="#if(isset($dataTypeContent-
>gender)){{ old('gender', $dataTypeContent->gender)
}}#else{{old('gender')}}#endif">
</div>
<div class="form-group">
<label for="name">DOB</label>
<input type="text" class="form-control"
name="dob"
placeholder="dob" id="dob"
value="#if(isset($dataTypeContent->dob))
{{ old('dob', $dataTypeContent->dob) }}#else{{old('dob')}}#endif">
</div>
<div class="form-group">
<label for="name">Phone_Number</label>
<input type="text" class="form-control"
name="phone_number"
placeholder="phone_number"
id="phone_number"
value="#if(isset($dataTypeContent-
>phone_number)){{ old('phone_number', $dataTypeContent->phone_number)
}}#else{{old('phone_number')}}#endif">
</div>
<div class="form-group">
<label for="name">Unit</label>
<input type="text" class="form-control"
name="unit"
placeholder="unit" id="unit"
value="#if(isset($dataTypeContent->unit))
{{ old('unit', $dataTypeContent->unit)
}}#else{{old('unit')}}#endif">
</div>
<div class="form-group">
<label for="name">Department</label>
<input type="text" class="form-control"
name="department"
placeholder="department" id="department"
value="#if(isset($dataTypeContent-
>department)){{ old('department', $dataTypeContent->department)
}}#else{{old('department')}}#endif">
</div>
<div class="form-group">
<label for="name">Company</label>
<input type="text" class="form-control"
name="company"
placeholder="company" id="company"
value="#if(isset($dataTypeContent-
>company)){{ old('company', $dataTypeContent->company)
}}#else{{old('company')}}#endif">
</div>
<div class="form-group">
<label for="name">Employment_status</label>
<input type="text" class="form-control"
name="employment_status"
placeholder="employment_status"
id="employment_status"
value="#if(isset($dataTypeContent-
>employment_status)){{ old('employment_status', $dataTypeContent-
>employment_status) }}#else{{old('employment_status')}}#endif">
</div>
<div class="form-group">
<label for="name">Guarantor1</label>
<input type="text" class="form-control"
name="guarantor1"
placeholder="guarantor1" id="guarantor1"
value="#if(isset($dataTypeContent-
>guarantor1)){{ old('guarantor1', $dataTypeContent->guarantor1)
}}#else{{old('guarantor1')}}#endif">
</div>
<div class="form-group">
<label for="name">Guarantor2</label>
<input type="text" class="form-control"
name="guarantor2"
placeholder="guarantor2" id="guarantor2"
value="#if(isset($dataTypeContent-
>guarantor2)){{ old('guarantor2', $dataTypeContent->guarantor2)
}}#else{{old('guarantor2')}}#endif">
</div>
<div class="form-group">
<label for="name">Academic_record</label>
<input type="text" class="form-control"
name="academic_record"
placeholder="academic_record"
id="academic_record"
value="#if(isset($dataTypeContent-
>academic_record)){{ old('academic_record', $dataTypeContent-
>academic_record) }}#else{{old('academic_record')}}#endif">
</div>
<div class="form-group">
<label for="name">Work Experience</label>
<input type="text" class="form-control"
name="work_experience"
placeholder="work_experience"
id="work_experience"
value="#if(isset($dataTypeContent-
>work_experience)){{ old('work_experience', $dataTypeContent-
>work_experience) }}#else{{old('work_experience')}}#endif">
</div>
<div class="form-group">
<label for="name">Note</label>
<input type="text" class="form-control"
name="notes"
placeholder="notes" id="notes"
value="#if(isset($dataTypeContent-
>notes)){{ old('notes', $dataTypeContent->notes)
}}#else{{old('notes')}}#endif">
</div>
</div><!-- panel-body -->
<div class="panel-footer">
<button type="submit" class="btn btn-
primary">Submit</button>
</div>
</form>
<iframe id="form_target" name="form_target"
style="display:none"></iframe>
<form id="my_form" action="{{ route('voyager.upload') }}"
target="form_target" method="post"
enctype="multipart/form-data"
style="width:0;height:0;overflow:hidden">
{{ csrf_field() }}
<input name="image" id="upload_file" type="file"
onchange="$('#my_form').submit();this.value='';">
<input type="hidden" name="type_slug" id="type_slug"
value="{{ $dataType->slug }}">
</form>
this is my Model code for the Profiles table:
<?php
namespace TCG\Voyager\Models;
use Illuminate\Database\Eloquent\Model;
use TCG\Voyager\Facades\Voyager;
class Profile extends Model
{
protected $table = 'profiles';
protected $fillable = [
'Staff_id',
'Title',
'First_name',
'Middle_name',
'last_name',
'Gender',
'DOB',
'Phone_number',
'Company',
'Department',
'Unit',
'Date_employed',
'Date_of_exit',
'Mode_of_exit',
'Employment_Status',
'Guarantor1_Details',
'Guarantor2_Details',
'Academic_Record',
'Work_Experience',
'Notes',
];
}
Add this line to the model to allow the remaining data to enter the database
protected $fillable = ['name_of_column', 'name_of_thenextcolumn'];
I was wondering if there is any way I can display more than one fields in the autocomplete search box. It already search for fist and last name but when the user types the last name it shows only the first name. But I wonder if there is a way that I can also display the last name or address on the search result. I am only getting the id of the guardian because it's the only thing I need to sent to the database. Here is a look at my code:
This is my function for the autocomplete:
public function autocomplete(Request $request)
{
$term=$request->term;
$data = Guardian::orWhere('first_name','LIKE','%'.$term.'%')
->orWhere('last_name','LIKE','%'.$term.'%')
->take(10)->get();
$results=array();
foreach($data as $key => $v)
{
$results[]=['id'=>$v->idguardian, 'value'=>$v->first_name];
}
return response()->json($results);
}
My view:
<div class="row">
<div class="col-md-6">
<h3>New Kid</h3>
<p> Please search the guardian name for the kid. If the guardian isn't registered please add it</p>
<form action="{{route('createkid')}}" method="post">
<div class="form-group">
<input type="text" name="searchname" class="form-control" id="searchname" placeholder="Search">
<tr>
<td>ID</td>
<td><input type="text" name="idguardian" id="idguardian" class="form-control"></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</div>
<a href="{{URL::to('addguardian/list/')}}" class="btn btn-success btn-xs" >Add Guardian</a>
<div class ="form-group">
<label for="first_name">First Name</label>
<input type="text" name="first_name" class="form-control" placeholder="FirstName">
</div>
<div class ="form-group">
<label for="middle_name">Middle Name</label>
<input type="text" name="middle_name" class="form-control" placeholder="MiddleName">
</div>
<div class ="form-group">
<label for="last_name">Last Name</label>
<input type="text" name="last_name" class="form-control" placeholder="LastName">
</div>
<div class ="form-group">
<label for="dateofbirth">Date Of Birth</label>
<input type="text" name="dateofbirth" class="form-control" placeholder="DateOfBirth">
</div>
<div class ="form-group">
<label for="sex">Sex</label>
<input type="text" name="sex" class="form-control" placeholder="Sex">
</div>
<div class ="form-group">
<label for="age">Age</label>
<input type="text" name="age" class="form-control" placeholder="Age">
</div>
<div class ="form-group">
<label for="schoolname">School Name</label>
<input type="text" name="schoolname" class="form-control" placeholder="SchoolName">
</div>
<div class ="form-group">
<label for="schoolgrade">School Grade</label>
<input type="text" name="schoolgrade" class="form-control" placeholder="SchoolGrade">
</div>
<div class ="form-group">
<label for="schoolgroup">School Group</label>
<input type="text" name="schoolgroup" class="form-control" placeholder="SchoolGroup">
</div>
<div class ="form-group">
<label for="bloodtype">Blood Type</label>
<input type="text" name="bloodtype" class="form-control" placeholder="BloodType">
</div>
<div class ="form-group">
<label for="allergies">Allergies</label>
<input type="text" name="allergies" class="form-control" placeholder="Allergies">
</div>
<div class ="form-group">
<label for="enroll_date">Enroll Date</label>
<input type="text" name="enroll_date" class="form-control" placeholder="EnrollDate">
</div>
<div class="form-group">
{!! Form::label('iduser','Select User') !!}
{!! Form::select('iduser', $kids, ['class' => 'form-control']) !!}
</div>
<button type="submit" class="btn btn-primary">Submit</button>
<input type="hidden" name="_token" value="{{ Session::token()}}">
</form>
</div>
</div>
<script type="text/javascript">
$("#searchname").autocomplete({
source : '{!!URL::route('autocomplete')!!}',
minLenght:1,
autoFocus:true,
select:function(e, ui){
$('#idguardian').val(ui.item.id);
}
});
</script>
My Route:
Route::get('/autocomplete',array('as'=>'autocomplete','uses'=>'KidsController#autocomplete'));
I really hope you can help me. Thank you!
Why not just append the last name onto the first name?
public function autocomplete(Request $request)
{
$term=$request->term;
$data = Guardian::orWhere('first_name','LIKE','%'.$term.'%')
->orWhere('last_name','LIKE','%'.$term.'%')
->take(10)->get();
$results=array();
foreach($data as $key => $v)
{
$results[]=['id'=>$v->idguardian, 'value'=>$v->first_name . ' ' . $v->last_name];
}
return response()->json($results);
}
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();
}
VIEW
{!! Form::open(array('route' => 'inspector.store','class' => 'form','id' => 'createinspector','name' => 'createinspector','files' => true)) !!}
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<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="{{ Input::old('firstname') }}" 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="{{ Input::old('email') }}" required="required">
</div>
<input type="checkbox" name="emailprivate" value="{{ Input::old('emailprivate') }}" 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="{{ Input::old('zip') }}" 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="{{ Input::old('company') }}" placeholder="Enter Company Name">
</div>
<div class="form-group">
<label>Website</label>
<input type="url" class="form-control" name="website" id="website" value="{{ Input::old('website') }}" 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="{{ Input::old('phone') }}" 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="{{ Input::old('freetext') }}" 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="{{ Input::old('inspectiontype') }}" 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="{{ Input::old('companybegindate') }}" 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="{{ Input::old('residaddress1') }}" 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="{{ Input::old('residaddress2') }}" placeholder="Enter Street Address 2">
</div>
<div class="form-group">
<label>City</label>
<input type="text" class="form-control" name="city" id="city" value="{{ Input::old('city') }}" 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="{{ Input::old('state') }}" 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="{{ Input::old('licname') }}" style="margin-bottom: 2px" placeholder="Enter Licensing name">
<input type="text" class="form-control" name="licid" id="licid" style="margin-bottom: 2px" value="{{ Input::old('licid') }}" placeholder="Enter Licensing ID">
<input type="text" class="form-control" name="licurl" id="licurl" style="margin-bottom: 2px" value="{{ Input::old('licurl') }}" 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..
I suppose it is because you try to set input value as array.
<select class="form-control select2" name="inspectiontype[]" id="inspectiontype" value="{{ Input::old('inspectiontype') }}" multiple="multiple" data-placeholder="Select Inspection Type" style="width: 100%;">
Here you try set array of ids as value of select, but you need to add selected attribute to selected option.
{{ Input::old('inspectiontype') }}
transforms to
<?php echo htmlentities(array('id1', 'id2'), ENT_QUOTES, 'UTF-8', false)?>
I would recommend you to use laravel collective form it will do it for you