B. Hurray B. Hurray - 2 months ago 29
HTML Question

Laravel 5 MethodNotAllowedHttpException in RouteCollection.php line 219:

While working with forms on my laravel project I keep getting this error I don't understand why.

It's an issue with my routes file as far as I understand it:

Route::post('postsmth', ['uses' => 'adminPageController@postsmth', 'as' => 'postsmth']);


Blade view:

<form action="{{ route('postsmth') }}" method="post">
<div class="input-group">
<span class="input-group-addon">Select from the list</span>
<select class="form-control" name="select1" id="select1">

<?php
for ($x = 0; $x <= 10; $x++) {
echo "<option value='$x'>".$x."</option>";
}
?>

</select>
</div>
<div class="input-group">
<span class="input-group-addon">Department ID</span>
<select class="form-control" name="select2" id="select2">
<?php
for ($y = 10; $y <= 20; $x++) {
echo "<option value='$y'>".$y."</option>";
}
?>

</select>
</div>
<button type="submit">Submit</button>
<input type="hidden" value="{{ Session::token() }}" name="_token">
</form>


Controller:

public function postmaps(Request $request) {


}

Answer

As stated in the comments it's as simple as that:

postmaps != postsmth

public function postsmth(Request $request) {


}

solves it

Comments