2

I have form like this

<form action="{{ Request::root() }}/articles/update/" method="post"> <input type="hidden" name="id" value="{{ $article->id }}" /> <input type="submit" name="submit" value="Submit" /> </form> 

And route like this

Route::post('articles/update', array('as' => 'articleUpdate', 'uses' => 'ArticlesController@update')); 

But when I submit the form, I get MethodNotAllowedHttpException. In error report I can see that request method is GET. I have also tried using caps for method method="POST" but it didn't work.

Any ideas?

2
  • the problem is more likely in laravel's configuration, if it $_GET your fields, it won't work if you POST them Commented Jun 21, 2013 at 17:16
  • I have another POST route that works. It was for login. But this one won't work Commented Jun 21, 2013 at 17:39

2 Answers 2

2

What does FireBug/Web console inspector show you? is the form being sent via GET or POST, any redirects?

Seems a redirection problem to me, after reaching the server Laravel redirects to the URL the form sent the post request.

Sign up to request clarification or add additional context in comments.

5 Comments

It seems that I have "Moved permanently - 301" for POST request, and than same request with GET method that fails.
Another thing I have noticed that it redirects without trailing slash although form action has trailing slash. Any ideas?
Remove the trailing slash from the form and test again. If this is the problem then the .htaccess needs to ignore these redirections when POST information is received
Works when I remove trailing slash. How should I edit .htaccess ?
I needed to add to my .env file this REDIRECT_HTTPS=false and it fixed my issue
0

you must use put method here. Form change like this

 {{Form::open(array('url'=>'/articles/update','method' => 'PUT'))}} 

Routes like this

 Route::put('/articles/update','ArticlesController@update'); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.