Sugiharso
Sugiharso

Reputation: 1

LARAVEL - INPUT ERROR - The POST method is not supported for this route. Supported methods: GET, HEAD

I'm trying to create an input form but couldn't find the solution from the error

This is what it said

My View Code

My Controller

My Router

I've tried some tips online but it still won't work

Upvotes: 0

Views: 60

Answers (3)

Sugiharso
Sugiharso

Reputation: 1

Sorry, got the answer

Route::post('CreateItem','CreateItem@insert'); to Route::post('/create_item','CreateItem@insert');

and

class CreateItem extends Controller

in my question, I typed the wrong controller name, it should be CreateItem

Thanks for the effort to answer my question tho..

Upvotes: 0

Nahuelsgk
Nahuelsgk

Reputation: 126

I think is related to the route name. Have you check which uri is posting the form? Can you try:

Route::post('/createItem', function () {
    //
})->name('createItem');

Upvotes: 0

user11537130
user11537130

Reputation: 296

It's because your route name is not defined. you should add the route name like this

Route::post('CreateItem', 'CreateItem@insert')->name('CreateItem');

Upvotes: 2

Related Questions