php - Laravel routing form with method get -
i'm using laravel 5.1 , have problem routing. currently, have on routes.php
route::get('/', 'articlesitecontroller@index'); route::get('article/search/{text}', 'articlecontroller@search'); route::get('article/{url}', 'articlecontroller@show'); route::get('/{url}', 'pagecontroller@index'); routes being redirected except search wherein use articlecontroller@show route.
on homepage, have search form.
<form class="form-horizontal" action="http://example.com/article/search/" method="get"> <input type="text" name="txtsearch" class="form-control" placeholder="search for..."> <span class="input-group-btn"> <button class="btn btn-primary" type="submit">go!</button> </span> </form> it redirects url: http://example.com/article/search/?txtsearch=test (which correct) uses articlecontroller@show method instead of articlecontroller@search.
it doesn't match article/search/{text}
you call http://example.com/article/search/ ?txtsearch=test query string. it's proper url articlecontroller@show action
http://example.com/article/search/test should handled articlecontroller@search
query params additional data passed specific route, they're not part of actual route.
Comments
Post a Comment