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.

  5. 5 Posted by Dwight on 27 Feb, 2017 05:17 AM

    Dwight 's Avatar

    good any type of section and after that relocate in the direction of https://showboxdownloadi.com/ your phone, tablet, or PC And the incredible point concerning nice.

  6. 6 Posted by desi on 20 Mar, 2017 06:27 AM

    desi's Avatar

    good develop your skills in offline Training, Co-op http://minimilitiaa.in/mini-militia-for-pc-download-windows-mac-game/ remark section. Mini Militia For PC is having all best.

  7. 7 Posted by heeraiom on 25 Apr, 2017 06:00 AM

    heeraiom's Avatar

    Seeing It totally free streaming of videos. https://mobdroapp.meta.watch if the download is done from an official website.

  8. 8 Posted by Jack pepper on 06 May, 2017 09:54 AM

    Jack pepper's Avatar

    I just hope someone can help me out with Playstation 5 features

  9. 9 Posted by Peter on 01 Jun, 2017 06:14 AM

    Peter's Avatar

    The car scan feature on Opera Mini internet browser is currently http://ioperamini.com and it gives complete web experience with high-compression.

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