David Brooks David Brooks - 11 months ago 33
PHP Question

Code Igniter not running the method in the controller

I have a form in a view called login_view that I would like to target a function in the Login controller.

For my form in login_view I have

echo form_open('/Login/validate_credentials');

In my Login.php controller I have:

<?php if (! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends CI_Controller{

function __construct()

public function validate_credentials(){

When I submit the form from the browser, instead of loading the welcome2 view like I expect, it tries to load the URL of:


and I just see the default page for WAMP.

It's my first day in Code Igniter so I'm sure the answer is simple.


Just replace your controller construct by this:

 public function __construct()