CodeIgniter Autocomplete Multiple input textbox with Database

CodeIgniter Autocomplete Multiple input textbox with Database

In this Post We Will Explain About is CodeIgniter Autocomplete Multiple input textbox with Database With Example and Demo.

Welcome on live24u.com – Examples ,The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Jquery select2 ajax autocomplete example with demo in PHP

In this post we will show you Best way to implement Autocomplete Select2 Codeigniter bootstrap Metro UI 3.0, hear for How to php – Select2 load data from database – CodeIgnite with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

You can download source code and Demo from below link.




Phase 1: Make Table

here show step by step to “CODEIGNITER 3 – SELECT2 jQuery AUTOCOMPLETE FROM DATABASE EXAMPLE WITH DEMO”.
In first of all created database and one created table we must have one table with some fake dummy records with this table structures.
-id
-name
-crated_at
-updated_at

Phase 2: Make View File

application/views/welcome_message.php

<html lang="en">
<head>
  <title>Jquery select2 ajax autocomplete  Devloped By Live24u.com</title>
  <!-- Include External jquery-->
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
  
  <!-- Include External CSS-->
  <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
  <!-- Include External js-->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
</head>
<body>

<div>
  <h2>Simple Select Box with Search Option Jquery Select2.js</h2>
  <select class="productName form-control" style="width:500px" name="productName"></select>
</div>

<script type="text/javascript">
      $('.productName').select2({
        placeholder: '--- Select Products ---',

        ajax: {
          url: '/search',

          dataType: 'json',

          delay: 250,

          processResults: function (data) {
            return {

              results: data

            };
          },

          cache: true
        }
      });
</script>
</body>

</html>

Phase 3: Create Route using CI_Controller

application/config/routes.php

In this Phase you need to add one create route for ajax search data all the products list. so open first of all routes.php file and simple put or add source code like as bellow:

$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['search'] = "search/index";

Phase 4: Create Controller

application/controllers/Search.php

and then, create simple new Search.php file in simple CI controllers folder and here easy put bellow code:

defined('BASEPATH') OR exit('No direct script access allowed');
class Search extends CI_Controller {
	public function index()

	{
		$result = [];
		$this->load->database();
		if(!empty($this->input->get("q"))){

			$this->db->like('name', $this->input->get("q"));

			$sql_query = $this->db->select('id,name as text')

						->limit(10)

						->get("tags");

			$result = $sql_query->result();

		}
		echo json_encode($result);
	}

}

Now, Good Luck we are simple autocomplete textbox ready to check, so we can check your own.

You can download source code and Demo from below link.




Example

I hope you have Got jQuery UI Autocomplete in CodeIgniter with Database And how it works.I would Like to have FeadBack From My Blog(live24u.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(live24u.com) Are Most Always Welcome.

http://live24u.com/wp-content/uploads/2017/08/CodeIgniter-Autocomplete-Multiple-input-textbox-with-Database-1024x575.pnghttp://live24u.com/wp-content/uploads/2017/08/CodeIgniter-Autocomplete-Multiple-input-textbox-with-Database-150x150.pngadminAjaxAPICodeigniterJavaScriptjQueryMysqlMysqliPHPAutocomplete Select2 Codeigniter bootstrap Metro UI 3.0,codeigniter - jquery autocomplete on select box change,Jquery select2 ajax autocomplete example with demo in PHP,jQuery UI Autocomplete in CodeIgniter with Database,Multiple input dengan Select2 dan Codeigniter,php - Select2 load data from database - CodeIgniterCodeIgniter Autocomplete Multiple input textbox with Database In this Post We Will Explain About is CodeIgniter Autocomplete Multiple input textbox with Database With Example and Demo. Welcome on live24u.com - Examples ,The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Jquery select2 ajax...BIGGEST AND FASTEST Web Tutorials - live24u.com

Sorry, comments are closed for this post