Project Tutorials
Introduction Directory Structure Project Setup Remove index.php using htaccess Change Default Controller CSS Add in Project Create Login Page Design Validation on Login Login with Database Flashdata on Login Display Username after Login Logout Design Dashboard Page List user data form database Insert Data Flash message show if data inserted Delete data from datebase Edit data from datebase Active Inactive user status Show active users detail on home page Image Upload Edit Image View Image on Home PageFlashdata on Login
In this tutorial, we are going to create flash message with the help of session flashdata.
eg. If you create a login and user enters the wrong username and password so it will show the error message.
What is Flashdata
You can perform different session message depends what you pass to view file from your controller.
Step 1 : Create flash message in your Login controller.
eg:
$this->session->set_flashdata('fail_login','Invalid Credentials');
here i am creating fail_login session name for flash message. So that it will show user's details is not correct.
Step 2 : Open your view file. So that we can pass fail_login message in login view page.
eg :
//here i getting flash message name
<?php if($error = $this->session->flashdata('fail_login')){ ?>
<p style="color: red;"><?= $error; ?></p>
<?php } ?>
Result :
Source Code:
Codeigniter tutorial for beginners
In this project. We are providing you, how to create small project in Codeign....
Source CodeElevenstech Web Tutorials
Elevenstech Web Tutorials helps you learn coding skills and enhance your skills you want.
As part of Elevenstech's Blog, Elevenstech Web Tutorials contributes to our mission of “helping people learn coding online”.
Read More
Newsletter
Subscribe to get the latest updates from Elevenstech Web Tutorials and stay up to date