0
I am studying Laravel and at the moment I am trying to understand how to send values of forms to be recovered and then redirect to a specific page. I’m still starting with Laravel and I don’t even know if that’s how it’s done.
So let’s say I have the following form:
<form action="action_page.php">
Username: <input type="text" name="userName"
<input type="submit">
</form>
And here I have 2 doubts:
- I don’t know if this is the right place to back up the form data
- I don’t know if this is the right way to go.
In Laravel I have the following route :
Route::post('/action_page',function(){
$userName = Input::get('userName');//Não sei se isso está correto.
if($userName=='paulo'){
retur view('pagina_paulo');
}
elseif($userName=='jose'){
retur view('pagina_jose');
}
});
This is the error that appears:
methodNotallowedhttpexception in routecollection.php ...
I looked into that page
Good explanation but from what I understood it not that go back to the form page but rather catch the user and check who it is, and then redirect to the right page!
– Igor Mello
Thanks for the comment @Igormello, I simply wanted to show the path of the parameters in a simple way, so he himself can create the logic and apply it to your needs. I also put an answer to the main problem, which in case is invalid route.
– Rafael Berro