collecting data in codeigniter

In this section we are going to collect the username and password with md5 encryption from the login page which I created earlier. Here is the code of my home controller as follows :

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

class Home extends CI_Controller
{
  public function index()
  {
    $this->load->view("home");
    
  }
  public function login()
  {
    $this->load->view("header");
    $this->load->view("login");
    $this->load->view("footer");
  }
   public function login_process()
   {
     if($this->input->post('u_login'))
     {
       $u_name=$this->input->post('u_name');
       $u_pass=md5($this->input->post('u_password'));
       $u_data=array('u_name'=>$u_name,'u_pass'=>$u_pass);
       echo "<pre>";
       var_dump($u_data);
       echo "</pre>";
     }
     else
     {
       redirect('login','refresh');
     }
   }
}


If you found any link error, it must be encountered due to the default base_url in the config.php file. Go and change it if you have an error.


Prev
Next

Comments

Popular posts from this blog

Node.js Cheat Sheet

Enhancing Supply Chain Security and Cloud-Native Development with Chainguard

Codeigniter ! Simple But Powerful