Registration Form Validation using Ajax in Codeigniter

Registration Form Validation using Ajax in Codeigniter

In this Post We Will Explain About is Registration Form Validation using Ajax in Codeigniter With Example and Demo.Welcome on – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Codeigniter Ajax Registration Form with Validation Example

In this post we will show you Best way to implement jQuery Ajax form validation in Codeigniter , hear for How To Integrate Codeigniter Form Validation Library and jQuery AJAX
with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Step 1: Create Routes

In first Phase You require to put simple two route for display HTML form and All the data post form. And then open simple Codeigniter routes.php file and put source code like as bellow example:

defined('BASEPATH') OR exit('No direct script access allowed');

$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

$route['stud'] = "stud/index";
$route['studentForm'] = "stud/studentForm";

Step 2: Create Item Controller

In this Second Phase, You need to make Item Codeigniter Controller as well as define two some methods, Like as a index() and studentForm() methods, Here You will also some load HTML form_validation and Codeigniter session library. simple path So let’s step by step proceed.

defined('BASEPATH') OR exit('No direct script access allowed');

class Item extends CI_Controller {

    * Get All Student Data from this method.
    * @return Response
   public function __construct() {


    * Create Student from display on this method.
    * @return Response Student
   public function index()

    * Store Data from this method.
    *Student form
    * @return Response
   public function studentForm()
        $this->form_validation->set_rules('student_fname', 'Student First Name', 'required');
        $this->form_validation->set_rules('student_lname', 'Student Last Name', 'required');
        $this->form_validation->set_rules('email', 'Student Email', 'required|valid_email');
        $this->form_validation->set_rules('res_address', 'Student Address', 'required');

        if ($this->form_validation->run() == FALSE){
            $errors = validation_errors();
            echo json_encode(['error'=>$errors]);
           echo json_encode(['success'=>'Record added successfully.']);

Step 3: Create View File

In last Phase, You need to make HTML view file, Therefor here make stud.php view file as well as copy bellow some source code, here You will data display form.

<!DOCTYPE html>
	<title>Simple Codeigniter Ajax Validation step by step Example</title>
	<!-- Devloped by free download examples -->
	<link rel="stylesheet" href="" />
	<!-- Devloped by free download examples -->
	<script src=""></script>
<!-- Devloped by free download examples -->
<div class="container">
	<h2>Step By step Codeigniter Ajax Validation Example</h2>

	<div class="alert alert-danger display-live-err-msg" style="display:none">
<!-- Devloped by free download examples -->
		<div class="form-group">
			<label>Student First Name:</label>
			<input type="text" name="student_fname" class="form-control" placeholder="Student First Name">

		<div class="form-group">
			<label>Student Last Name:</label>
			<input type="text" name="student_lname" class="form-control" placeholder="Student Last Name">

		<div class="form-group">
			<input type="text" name="email" class="form-control" placeholder="Student Email">

		<div class="form-group">
			<strong>Student Address:</strong>
			<textarea class="form-control" name="res_address" placeholder="Student Address"></textarea>

		<div class="form-group">
			<button class="btn btn-success btn-submit">Submit</button>

<script type="text/javascript">

	$(document).ready(function() {

	    	var _token = $("input[name='_token']").val();
	    	var student_fname = $("input[name='student_fname']").val();
	    	var student_lname = $("input[name='student_lname']").val();
	    	var email = $("input[name='email']").val();
	    	var res_address = $("textarea[name='res_address']").val();

	            url: "/studentForm",
	            dataType: "json",
	            data: {student_fname:student_fname, student_lname:student_lname, email:email, res_address:res_address},
	            success: function(data) {





Good Luck we are all the steps ready to this full source code example.

php -S localhost:8000

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example


I hope you have Got What is registration form validation using jquery in codeigniter And how it works.I would Like to have FeedBack From My Blog( readers.Your Valuable FeedBack,Any Question,or any Comments about This Article( Are Most Always Welcome.

Related FAQ

Here are some more FAQ related to this Article:

  1.   WooCommerce Get Product Variations
  2.   How to Find IP Address on CentOS 8
  3.   Eloquent ORM Soft Delete in Laravel 6
  4.   PHP Laravel 6 Multiple Database Connections Tutorial
  5.   PHP Laravel framework session Example
  6.   CheckBoxes using Angular Example
  7.   PHP CodeIgniter 3 Validation Example Tutorial From Scratch
  8.   Simple React Hello World Example
  9.   open link in new tab react Example Tutorial
  10.   Lowercase Filter using Angular Example

Leave a Reply

Your email address will not be published. Required fields are marked *