jquery Autocomplete Tags with multiple values using PHP/MySQLi

jquery Autocomplete Tags with multiple values using PHP/MySQLi

In this Post We Will Explain About is jquery Autocomplete Tags with multiple values using PHP/MySQLi 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 PHP – Bootstrap autocomplete Tags with Ajax Example

In this post we will show you Best way to implement Autocomplete with PHP, MySQL and Jquery UI, hear for Autocomplete textbox with multiple values using jquery, php and mysql with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Also Read :   Autocomplete textbox using jQuery PHP and MySQL




jQuery Tags Input Plugin with Typeahead Autocompletion

Include External Files

<head>
  <title>PHP - Bootstrap autocomplete Tags with Ajax</title>
  <!--external Css Files-->
  <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"> 
  <link rel="stylesheet" type="text/css" href="1.12.1/jquery-ui.min.css"> 
  <link rel="stylesheet" type="text/css" href="css/bootstrap-tokenfield.min.css">

  <!--external JS Files -->
  <script src="jquery/2.1.1/jquery.min.js"></script>
  <script src="1.12.1/jquery-ui.min.js"></script>
  <script src="0.12.0/bootstrap-tokenfield.js"></script>
</head>

Create index.php File

<!DOCTYPE html>
<html>
<body>

<h2>Bootstrap Autocomplete Tags with Ajax using PHP/MySQLi</h2>
<div class="container">
  <input type="text" class="live form-control" id="livetagid" />
</div>

<p>Live24u is the most popular Programming & Web Development blog. Our mission is to provide the best online resources on programming and web development. We deliver the useful and best tutorials for web professionals — developers, programmers, freelancers and site owners. Any visitors of this site are free to browse our tutorials, live demos and download scripts.</p>

<script type="text/javascript">
  $('#livetagid').tokenfield({
    autocomplete: {
      source: function (request, response) {
          jQuery.get("do_get_res.php", {
			//request ajax call using ajax
              query: request.term
          }, function (data) {
			//get response
              data = $.parseJSON(data);
              response(data);
          });
      },
      delay: 100 //delay response
    },
    showAutocompleteOnFocus: true
  });
</script>


</body>
</html>

Create do_get_res.php File

<?php
	define (DB_USER, "username");
	define (DB_PASSWORD, "password");
	define (DB_DATABASE, "My_dataBase_name");
	define (DB_HOST, "hostname");

	//database connection
	$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);

	$myquerysql = "SELECT name FROM tags 
			WHERE name LIKE '%".$_GET['query']."%'
			LIMIT 10"; 

	$dataresult = $mysqli->query($myquerysql);

	$jsonData = [];
	while($row = $dataresult->fetch_assoc()){
	     $jsonData[] = $row['name'];
	}


	echo json_encode($jsonData);
?>

And then maked successfully both simple PHP files, We can run by following simple CMD command:

Also Read :   Print number Pattern Program in PHP

php -S localhost:8000

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





Example

I hope you have Got What is Insert Multiple Bootstrap Tags Data using Ajax PHP And how it works.I would Like to have FeedBack From My Blog(live24u.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(live24u.com) Are Most Always Welcome.