Create login form in Codeigniter - phptpoint

Create login form in Codeigniter

/ins>

Create login form in Codeigniter

In this tutorial we will understand how to create simple login form in CodeIgniter.
For login page we will check student’s email and password is valid then redirect on dashboard method.
otherwise display an error message on login view page.

We will use student table to login

This is student table structure

Table Name : student
student_id int primary key auto_increment
name char(50)
email varchar(100)
password varchar(100)
mobile bigint
course char(100)

Controller

Copy the below given code in your User Controller.

Login View

Copy the below given code in your login.php View Page.

Execute User Controller’s login method

Open your web browser and Pass : http://localhost/CodeIgniter/index.php/user/login

Output(if wrong email or Password)


Dashboard View

Copy the below given code in your dashboard.php View Page.

Output(Dashboard page)