The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

Method not allowed. Must be one of: POST problem

Erdem's Avatar

Erdem

13 Mar, 2016 10:30 AM

Hi there,

I have a form that edits a category. the form has hidden input value which is category id.

form route
$app->get('/en/admin/edit-category/{categoryId}', function ($request, $response, $args) { //form view });

and this is route where I edit the category with given ID

    $app->post('/en/admin/edit-category', function ($request, $response, $args) {

      $this->logger->info("Edit Category '/edit-category' route");

      $updateCategory = $this->category->editCategory( $request->getParsedBody()['categoryId'],
                                    $request->getParsedBody()['categoryParent'],
                                    $request->getParsedBody()['categoryName'],
                                    $request->getParsedBody()['categorySlug'],
                                    $request->getParsedBody()['categoryDescription'],
                                    $request->getParsedBody()['visibility'] );

      // if I delete this bıt of code I don get that error
      if( $updateCategory !== false ) {
        $this->flash->addMessage('success', 'Category succesfuly edited!');
        return $response->withStatus(301)->withHeader('Location', '/en/admin/category-list');
      } else {
        $this->flash->addMessage('error', $this->category->errors);
        return $response->withStatus(301)->withHeader('Location', '/en/admin/edit-category');
      }

    });

but when I post the from I get the error but when I delete the code starting from if( $updateCategory !== false ) { I don't gett the error

can you please tell me whats wrong with my code?
thanks.

  1. 1 Posted by Rob Allen on 13 Mar, 2016 10:50 AM

    Rob Allen's Avatar

    What's the URL in the form's action?

  2. 2 Posted by doloresdeaniel on 08 Jul, 2016 05:39 AM

    doloresdeaniel's Avatar

    good the unit installation black stacks available and demonstrate the set of apps. http://snapchatupdate.com therefore mind to the iOS. Snapchat Night time nice.

  3. 3 Posted by cardinallinda52... on 31 Dec, 2016 09:41 AM

    cardinallinda5201's Avatar

    awesome after that to iTunes and app shop. You can see in the below image. https://cinemaboxapkz.com/cinema-box-ios-hd-app-download-for-iphone-ipad/ Contains a wonderful library of top quality web nice.

  4. 4 Posted by lpoiu on 15 Feb, 2017 07:54 AM

    lpoiu's Avatar

    good adhering to client feedback. Vidmate Newest Version https://vidmatedownloadl.com You could also make use of a third party app best.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac