Home » CodeIgniter Login Form

CodeIgniter Login Form

by Online Tutorials Library

Login Form in CodeIgniter (without MySQL)

Here, we’ll make a simple login page with the help of session.

Go to file autoload.php in application/config/autoload.php

Login Form in CodeIgniter1

Set session in library and helper.

Create controller page Login.php in application/controllers folder.

Look at the above snapshot, we have created a session for a single user with Username juhi and Password 123. For a valid login and logout we will use this username and password.

Create view page login_view.php in application/views folder.

Create view page welcome_view.php in application/views folder to show the successful login message.

Output

Type URL localhost/login/index.php/Login

Login Form in CodeIgniter5

Now on entering wrong information we’ll be see unsuccessful message which we have set in login_view page in else part.

Login Form in CodeIgniter6
Login Form in CodeIgniter7

Now on entering right information, we’ll see welvome_view.php message.

Login Form in CodeIgniter8
Login Form in CodeIgniter9

Click on Logout, we’ll be directed to Login page.

Next TopicLogin page

You may also like