Reputation: 37
I am new to laravel and working on a form.
This is the form
<form action="/product" method="GET">
<div class="input-group">
<input type="text" class="form-control" placeholder="Enter product name" />
<div class="input-group-btn">
<input type="submit" class="btn btn-danger" value="Search" />
</div>
</div>
And this is the Route
I have written
Route::get('/product/{product}', 'FlashCartController@find_product');
When I submit my form it says
NotFoundHttpException in RouteCollection.php line 161:
How do I submit this form?
Upvotes: 1
Views: 51
Reputation: 8673
In this case you need product ID in the form action. For example
<form action="/product/{{$productId}}" method="GET">
If you just want to create new product then lose the {product} and change the GET to POST as forms are submitted with mostly with POST.
<form action="/product" method="POST">
Route::post('/product', 'FlashCartController@find_product');
Upvotes: 1