Answer the question
In order to leave comments, you need to log in
How to insert anchor into laravel routing?
After filling out the form, you need to insert anchor (anchor) #spasibo into the address bar. <form action="/order/<?= $item->id ?>#spasibo">
How to handle such a link in routing?
Route::post('/order/{item}', '[email protected]');
Answer the question
In order to leave comments, you need to log in
The anchor is not transmitted to the server at all :) This is purely for the browser. If you want to send something to the server - write like this:
On the server, respectively, the code will be as follows:
Route::get('/order/{item}', function() {
$spasibo = isset($_GET['spasibo']); // Вернёт boolean в переменную spasibo
});
What error does it give? Judging by your code, you submit the form via GET (since the method is not explicitly specified in the form), and the route listens to POST. Hence the error.
You can try doing this: /order/<?= $item->id ?>/#spasibo
In general, the anchor should be ignored by the server, it's client information.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question