• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Request method doesn't work when I use modules

Everything works fine using a module, but there is an issue I get for example I have a login module, there are two methods in the login module controller index method and create method. The index method shows the login form and the create method processes the form. The problem is when I click the submit button on the index method to go to the create method there's an error "controller or method not found", but if I try to access the method directly via GET method I don't get the error. Any suggestions please?


namespace Modules\Login\Controllers;

class Login extends \CodeIgniter\Controller {

// shows login form
public function index() {

public function create () {

echo "this is a post";
echo "this is a get";



Any help to why post method returns controller or method error but get shows the echo.

Take a look at Myth/Auth and you will see how it is done.

Look at the routes in the auth module.

PHP Code:
$routes->group('', ['namespace' => 'Myth\Auth\Controllers'], function($routes) {
    // Login/out
    $routes->get('login''AuthController::login', ['as' => 'login']);

See the top two routes one is a get the other a post.

Now look at the two methods in the AuthController to see how they work.

What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.