1

Im trying to do a post request via a form in my blade template with a parameter in the url . Here is my form:

<form action="/products/{{$produit->id}}" method="post"> {{ csrf_field() }} <input type="text" name="avis_body" /> <input type="submit" value="Send" /> </form> 

Here is my web.php:

Route::post('/products/{$id}', function($id){ return $id; }); 

I don't know what im doing wrong. Im receiving this error: enter image description here

2
  • typo {{$produit->id}} ? check if it is null Commented Apr 14, 2018 at 19:19
  • no it is not null Commented Apr 14, 2018 at 19:23

1 Answer 1

4

Remove the $ from route declaration:

Route::post('/products/{id}', function($id){ return $id; }); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.