jeudi 23 mars 2017

Laravel POST is unable to function

So I am a beginner to Laravel and I was expiremnting with POST and GET. So I attempted to create a simple form in my views directory called form.blade.php:

<head>
    <meta charset = "UTF-8">
    <title></title>
</head>


<body>
    <form action="" method="POST">
        
        <input type="hidden" name="foo" value="bar" />
        <input type="hidden" name="baz" value="boo" />
        <input type="submit" value="send" />
    </form>

</body>

My routes file was like this:

Route::get('post-form', function(){
    return view('form');

});

Route::post('/', function(){
    $data= Request::all();
    var_dump($data);

});

As soon as I attempt to submit the form, an error is thrown at me: MethodNotAllowedHttpException in RouteCollection.php line 233:

I do not understand why this is happening as my logic seems to be correct to me. Any help and solutions would be greatly appreciated. Thank you!



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2nNdhjN
via IFTTT

Aucun commentaire:

Enregistrer un commentaire