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. I do believe i need code in my controller.
SEARCH.BLADE.PHP
<form action="/search" method="POST" role="search">
<div class="form-group">
<select name="country" id="country" class="form-control input-lg dynamic" data-dependent="state">
@foreach($posts as $post)
<option value="{{$post->distance}}">{{$post->distance}} </option>
@endforeach
<br/>
<div class="form-group">
<select name="state" id="state" class="form-control input-lg dynamic" data-dependent="city">
</select>
</div>
<br />
<div class="form-group">
<select name="city" id="city" class="form-control input-lg">
@foreach($posts as $post)
<option value="{{$post->title}}">{{$post->title}} </option>
@endforeach
</div>
</select>
</div>
</div>
{{Form::Submit('submit', ['class' => 'btn btn-primary'])}}
</body>
SearchController.php
class SearchController extends Controller {
public function index()
{
$posts = Post::all();
return view('Pages.search')->with('posts', $posts);
}
I do not have much is the search controller but i do believe i need some code in there to display the data.
<select>tag with</select>, and debug$poststo insure in has data from database</select>tags. also you can clean up your controller code with using compactreturn view('Pages.search', compact('posts'));<button type="submit" class="btn btn-adminsqure pull-right submitbutton"> Submit</button>