I am implementing a drop down menu list to display a list of hotels from my system. I currently have the following code which when i click submit, nothing is happening (no data displayed).
Does anyone know how i can potentially display data once i press submit ?
Search.Blade.php
{!! Form::open(['action' => 'SearchController@index', 'method' => 'POST']) !!}
<div class="form-group">
<select name="title" id="title" class="form-control input-lg dynamic" data-dependent="state">
@foreach($posts as $post)
<option value="{{$post->id}}">{{$post->title}} </option>
@endforeach
</select>
<br>
<div class="form-group">
{{Form::Submit('submit', ['class' => 'btn btn-primary'])}}
</div>
<div class="table">
<table>
<tr>
<th>Hotel Name</th>
<td>{{$post->title}}</td>
<th>Distance</th>
<td>{{$post->distance}}</td>
<th>Images</th>
<td>{{$post->image}}</td>
</tr>
<tr>
</tr>
</td>
</div>
SearchController.php
public function index()
{
$posts = Post::get();
return view('Pages.search', compact('posts'));
}
public function store(Request $request)
{
}
So when i press submit, it takes me to a white blank page. Im not sure how to retrieve the data from the selected drop down list and display it on my page, if any one knows how to do so please advise.