Tech Arise

Create Login Form with CodeIgniter and MySQL

The most common way of authenticating a user in web applications is through a login form. It is usually used to check the authenticity of the use. In this tutorial, we will create a simple login system using CodeIgniter and MySQL. So here we have handled login functionality by creating a simple login form in CodeIgniter and Bootstrap Framework along with MySQL Database. This is a very simple example, you can just copy-paste and change according to your requirement.
Before started to implement the Create Login using CodeIgniter, look files structure:
Step 1: Create the Database and Table
For this tutorial, you need a MySQL database with the following table:
Step 2: Configure Database access
Update the file application/config/database.php in your CodeIgniter installation with your database info:
Step 3: Update routes file
Add code the file application/config/routes.php in your CodeIgniter installation with you controller’s name.
Step 4: Update autoload file
In the file application/config/autoload.php you can configure the default libraries you want to load in all your controllers. For our case, we’ll load the database and session libraries, since we want to handle user sessions, and also the URL helper for internal link generation.
Step 5: Create Model
Create a model file named Users_model.php inside “application/models” folder.
Step 6: Create controllers
Create a controllers file named Users.php inside “application/controllers” folder.
Step 7: Create views
Create a views file named index.php inside “application/views/users” folder.
Step 7: Create views
Create a views file named thank-you.php inside “application/views/users” folder.
Exit mobile version