How to write form action in html/php code in laravel?


Ask A Question





Login To post a question

I am working on the live search of an HTML form in which if I type La, everything should show up related to La example: La Man, La Fa etc.

The HTML code which I have used for that are:

<form autocomplete="off" id="search_form" method="GET" action="/search/helloWorld/{chars}">
   <div  style="padding-top:18%;margin-left:auto; margin-right:auto;">
      <!--           
         <div class="dates">
           <div class="start_date" style="width:50%;margin-right:3%;">
              <input readonly="readonly" class="form-control start_date  mb-4" type="text" placeholder="start date" id="startdate_datepicker">
           </div>
           <div class="end_date" style="width:50%;margin-left:3%;">
              <input readonly="readonly" class="form-control  end_date  mb-4" type="text" placeholder="end date" id="enddate_datepicker">
           </div>
         </div>
         -->
      <button type="submit" class="btn btn-default start_search_button" style="padding-left:12%;padding-right:12%;background-color: rgb(247, 144, 99);" >start search</button>
      <input type="hidden" name="filter[lat_long]" value="45.3528292,-75.7599609">
   </div>
</form>

The routing which I have done for the routes.php file is:

//typeahead routes
Route::get('search/typeahead/{chars}','SearchController@typeAhead');

Problem Statement:

I am wondering if I have written action="/search/helloWorld/{chars}"> in the right way in the html code above. Do we write form action by seeing the routes in in Laravel (5) ?

For more info please click herehttps://stackoverflow.com/q/51802267



Have a question or need a custom quote?
info@smartinfocare.com