Tagged: php and mysql

Ajax Autocomplete Live Search Suggestion using PHP MySQL 0

Ajax Autocomplete Live Search Suggestion using PHP MySQL

Today, We want to share with you Ajax Autocomplete Live Search Suggestion using PHP MySQL.In this post we will show you PHP Ajax Autocomplete Search from Database Example, hear for Auto complete search with Ajax, jQuery, PHP and MYSQL we will give you demo and example for implement.In this post, we will learn about Search Suggestion Functionality with PHP and MySQL with an example.

Ajax Autocomplete Live Search Suggestion using PHP MySQL

There are the Following The simple About Ajax Autocomplete Live Search Suggestion using PHP MySQL Full Information With Example and source code.

As I will cover this Post with live Working example to develop Autocomplete Textbox using jQuery, PHP and MySQL, so the Autocomplete with PHP, MySQL and Jquery UI for this example is following below.

Step 1: HTML Interface

index.html

First of all, let’s simple create HTML an index.html file for Autocomplete or Search Suggestion.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="Content-Language" content="en-us">
    <title>Autocomplete Textbox using jQuery, PHP and MySQL - Pakainfo.com</title>
    <meta charset="utf-8">
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    <script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
    <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script src="//netsh.pp.ua/upwork-demo/1/js/typeahead.js"></script>
    <style>
        h1 {
            font-size: 20px;
            color: #f5f5f5f;
        }

        .content {
            width: 80%;
            margin: 0 auto;
            margin-top: 60px;
        }

        .tt-hint,
        .city {
            border: 2px solid #c60000;
            border-radius: 10px 10px 10px 10px;
            font-size: 24px;
            height: 45px;
            line-height: 30px;
            outline: medium none;
            padding: 10px 12px;
            width: 500px;
        }

        .tt-dropdown-menu {
            width: 500px;
            margin-top: 5px;
            padding: 10px 12px;
            background-color: #fff;
            border: 1px solid #ccc;
            border: 1px solid rgba(0, 0, 0, 0.2);
            border-radius: 10px 10px 10px 10px;
            font-size: 110px;
            color: #111;
            background-color: #3d3d3d;
        }
    </style>
    <script>
        $(document).ready(function() {

            $('input.city').typeahead({
                name: 'city',
                remote: 'get_members.php?search=%SEARCH'

            });

        })
    </script>
</head>

<body>
    <div class="Pakainfo content">

        <form>
            <h1>Please type of the City or Zip code</h1>
            <input type="text" name="city" size="30" class="city" placeholder="Please Enter Your City or Country ZIP code">
        </form>
    </div>
</body>

</html>

Step 2: Serever Side Source code

get_members.php

And then I shall create a PHP Page mysql.php file which will all the aggregate Mysql Database query to MySQL DB as well as also give outpur response as type of the JSON. Serever Side Code for Creating Autocomplete or Search Suggestion Functionality with PHP and MySQL

<?php

//CREDENTIALS FOR Database
define ('DBSERVER', 'localhost');
define ('DBUSER', 'root');
define ('DBPASS','Mypassword');
define ('DBNAME','memberlist');

$connection = mysql_connect(DBSERVER, DBUSER, DBPASS) or die("Can't connect to server.");
$result = mysql_select_db(DBNAME) or die("Can't your select database.");

//CREATE Mysql search TO Database as wel as PUT RECEIVED DATA INTO PHP ASSOCIATIVE ARRAY
if (isset($_REQUEST['search'])) {
    $search = $_REQUEST['search'];
    $sql = mysql_query ("SELECT zip, city FROM zips WHERE city LIKE '%{$search}%' OR zip LIKE '%{$search}%'");
	$membersarray = array();
    while ($datamembers = mysql_fetch_array($sql)) {
        $membersarray[] = array (
            'label' => $datamembers['city'].', '.$datamembers['zip'],
            'value' => $datamembers['city'],
        );
    }
    //RETURN JSON ARRAY
    echo json_encode ($membersarray);
}

?>

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Ajax Autocomplete Live Search Suggestion using PHP MySQL.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

PHP MySQL Dynamic Treeview using jQuery Ajax Example 0

PHP MySQL Dynamic Treeview using jQuery Ajax Example

Today, We want to share with you PHP MySQL Dynamic Treeview using jQuery Ajax Example.In this post we will show you Dynamic Tree with JSTree, PHP and MySQL, hear for PHP Dynamic Tree View Plugin With jQuery And Bootstrap we will give you demo and example for implement.In this post, we will learn about Create Dynamic Treeview Example using JQuery Ajax in PHP MySQL with an example.

PHP MySQL Dynamic Treeview using jQuery Ajax Example

There are the Following The simple About PHP MySQL Dynamic Treeview using jQuery Ajax Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop how to create Ajax treeview in php MySQL, so the some jQuery Ajax tree structure in php with mysql for this example is following below.

Step 1: Create student table

SQL query student table:

CREATE TABLE IF NOT EXISTS `student` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `std_id` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2

Step 2: Create HTML Interface

index.php

<!DOCTYPE html>
<html>
<head>
  <title>PHP Dynamic Tree View Plugin With jQuery And Bootstrap - PHP MySQLi Example</title>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-treeview/1.2.0/bootstrap-treeview.min.css" />
  <script type="text/javascript" charset="utf8" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js"></script>
  <script type="text/javascript" charset="utf8" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-treeview/1.2.0/bootstrap-treeview.min.js"></script>
</head>
<body>
<h1>Create Treeview using Bootstrap Treeview Ajax JQuery with PHP</h1>  
<div class="container">
  <div class="panel panel-default">
    <div class="panel-heading">
      <b>Ajax Dynamic Tree with jquery, PHP and MySQL - pakainfo.com</b>
    </div>
    <div class="panel-body">
      <div class="col-md-8" id="studentiew_treejson">
      </div>
    </div>
  </div>
</div>
  
<script type="text/javascript">
$(document).ready(function(){
  
   var treestudData;
   
   $.ajax({
        type: "GET",  
        url: "/getstudents.php",
        dataType: "json",       
        success: function(results)  
        {
          studentsTreeData(results)
        }   
  });
   
  function studentsTreeData(treestudData) {
    $('#studentiew_treejson').treeview({data: treestudData});
  }
   
});
</script>
   
</body>
</html>

Step 3: Database configuration

config.php

<?php
  
    $hostName = "localhost";
    $username = "root";
    $password = "[email protected]";
    $dbname = "students_master";
   
    $mysqli = new mysqli($hostName, $username, $password, $dbname);
  
?> 

Step 4: Create Ajax File Call on Server side

getstudents.php

<?php
    
    require 'config.php';
  
    $parentKey = '0';
    $sql = "SELECT * FROM student";
  
    $studresult = $mysqli->query($sql);
   
      if(mysqli_num_rows($studresult) > 0)
      {
          $data = studentsTree($parentKey);
      }else{
          $data=["id"=>"0","name"=>"No Students present in list","text"=>"No Students is present in list","nodes"=>[]];
      }
   
      function studentsTree($parentKey)
      {
          require 'config.php';
  
          $sql = 'SELECT id, name from student WHERE std_id="'.$parentKey.'"';
  
          $studresult = $mysqli->query($sql);
  
          while($datavalue = mysqli_fetch_assoc($studresult)){
             $id = $datavalue['id'];
             $allstudData[$id]['id'] = $datavalue['id'];
             $allstudData[$id]['name'] = $datavalue['name'];
             $allstudData[$id]['text'] = $datavalue['name'];
             $allstudData[$id]['nodes'] = array_values(studentsTree($datavalue['id']));
          }
  
          return $allstudData;
      }
  
      echo json_encode(array_values($data));
  
?>

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP MySQL Dynamic Treeview using jQuery Ajax Example.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

JQuery Ajax Dynamic Treeview using PHP MySQL Example 0

JQuery Ajax Dynamic Treeview using PHP MySQL Example

Today, We want to share with you JQuery Ajax Dynamic Treeview using PHP MySQL Example.In this post we will show you Dynamic Tree with JSTree, PHP and MySQL, hear for Dynamic Treeview Menu using PHP, MySQL and AJAX Example we will give you demo and example for implement.In this post, we will learn about Create Dynamic Treeview Example using JQuery Ajax in PHP MySQL with an example.

JQuery Ajax Dynamic Treeview using PHP MySQL Example

There are the Following The simple About JQuery Ajax Dynamic Treeview using PHP MySQL Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop Dynamic Treeview with jQuery & Laravel PHP Example, so the some major files and Directory structures for this example is following below.

  • index.php
  • database_conn.php
  • calldo_ajax.php

Step 1: Create member table

member table:

simple mysql Run This Query and save Database structures.

CREATE TABLE IF NOT EXISTS `member` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `parent_id` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2

Step 2: Create index.php File

This is where I will make a simple HTML form and PHP server side source code for our web application. To make the forms simply all souce code copy and write it into your any text editor Like Notepad++, then save file it as index.php.

index.php

<!DOCTYPE html>
<html>
<head>
  <title>Create Dynamic Treeview Example with PHP MySQL - Pakainfo.com</title>
  <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-treeview/1.2.0/bootstrap-treeview.min.css" />
  <script type="text/javascript" charset="utf8" src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js"></script>
  <script type="text/javascript" charset="utf8" src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-treeview/1.2.0/bootstrap-treeview.min.js"></script>
</head>
<body>
<div class="container">
  <div class="panel panel-default">
    <div class="panel-heading">
      <h1>Create Dynamic Treeview Example with PHP MySQL - pakainfo.com</h1>
    </div>
    <div class="panel-body">
      <div class="col-md-8" id="live_tree_json_view">
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){
   var liveMemberData;
   $.ajax({
        type: "GET",
        url: "/calldo_ajax.php",
        dataType: "json",
        success: function(response)
        {
          initTree(response)
        }
  });
  function initTree(liveMemberData) {
    $('#live_tree_json_view').treeview({data: liveMemberData});
  }
});
</script>
</body>
</html>

Step 3: Create AJAX and Config File

database_conn.php

<?php
    $hostName = "localhost";
    $username = "atmiys";
    $password = "jdaits";
    $dbname = "customtree";
    $mysqli = new mysqli($hostName, $username, $password, $dbname);
?>

calldo_ajax.php
<?php
    require 'database_conn.php';
    $masterKey = '0';
    $sql = "SELECT * FROM member";
    $response = $mysqli->query($sql);
      if(mysqli_num_rows($response) > 0)
      {
          $data = membersTree($masterKey);
      }else{
          $data=["id"=>"0","name"=>"No Members available in member list","text"=>"No Members is available in member list","nodes"=>[]];
      }
      function membersTree($masterKey)
      {
          require 'database_conn.php';
          $sql = 'SELECT id, name from member WHERE parent_id="'.$masterKey.'"';
          $response = $mysqli->query($sql);
          while($value = mysqli_fetch_assoc($response)){
             $id = $value['id'];
             $dataRow[$id]['id'] = $value['id'];
             $dataRow[$id]['name'] = $value['name'];
             $dataRow[$id]['text'] = $value['name'];
             $dataRow[$id]['nodes'] = array_values(membersTree($value['id']));
          }
          return $dataRow;
      }
      echo json_encode(array_values($data));
?>

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about JQuery Ajax Dynamic Treeview using PHP MySQL Example.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Laravel AJAX Live Autocomplete Search from Database 0

Laravel AJAX Live Autocomplete Search from Database Example

Today, We want to share with you Laravel AJAX Live Autocomplete Search from Database Example.In this post we will show you jQuery Autocomplete Tutorial with Laravel 5.7 and MySQL, hear for Laravel 5.7 Ajax Autocomplete Search from Database Example we will give you demo and example for implement.In this post, we will learn about Laravel 5.7 Autocomplete Search From Database Using Typeahead Tutorial Example with an example.

Laravel AJAX Live Autocomplete Search from Database Example

There are the Following The simple About Laravel AJAX Live Autocomplete Search from Database Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop Autocomplete Textbox using Laravel 5.7, PHP and MySQL, so the some major files and Directory structures for this example is following below.

  • Setup Laravel 5.7 Project
  • Settings .env files SQL Database
  • build Laravel 5.7 Model and Migration Database
  • make Laravel 5.7 a HTML View File
  • make Laravel 5.7 one controller
  • Laravel 5.7 Route
  • Store data Laravel 5.7 to the database
  • make an index page Laravel 5.7 Search the data
  • Include jQuery in the view Index File

Laravel 5.7 Autocomplete Search From Database Using Typeahead Tutorial Example

#1: Setup Laravel 5.7 Application

Install Laravel 5.7 Project step by step

composer create-project --prefer-dist laravel/laravel liveautocompletebox

Step #2: Settings SQL Database

.env files on root

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=liveautocompletebox
DB_USERNAME=root
DB_PASSWORD=

Step #3: build Laravel 5.7 Model and Migration Database

Laravel 5.7 Model and Migration files

php artisan make:model Member -m 

make the member.php file as well as create a create_members_table.php

//Ajax Autocomplete Textbox in Laravel 5.7 using jQuery
public function up()
    {
        Schema::create('members', function (Blueprint $table) {
            $table->increments('id');
            $table->string('membername');
            $table->timestamps();
        });
    }

Database >> member table.

php artisan migrate

Step #4: Make a Laravel 5.7 View File

resources/views/createmember.blade.php

<!-- createmember.blade.php for Ajax Autocomplete Textbox in Laravel 5.7 using jQuery -->

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Laravel 5.7 Autocomplete Search From Database Tutorial With Example</title>
    <link rel="stylesheet" href="{{asset('css/app.css')}}">
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  </head>
  <body>
    <div class="container">
      <h2>Laravel 5.7 AJAX Live Autocomplete Search from Database Example</h2><br/>
      <form method="post" action="{{url('store')}}">
        @csrf
        <div class="row">
          <div class="col-md-4"></div>
          <div class="form-group col-md-4">
            <label for="Name">Member Name:</label>
            <input type="text" class="form-control" name="membername">
          </div>
        </div>
        <div class="pakainfo row">
          <div class="col-md-4"></div>
          <div class="form-group col-md-4">
            <button type="submit" class="btn btn-success">Add Member</button>
          </div>
        </div>
      </form>
   </div>
  </body>
</html>

Step #5: Make Laravel 5.7 controller

create Laravel Controller as well as Model

php artisan make:controller MemberController

MemberController.php

//MemberController.php
//Ajax Autocomplete Textbox in Laravel 5.7 using jQuery

public function create()
    {
        return view('createmember');
    }

Step #6: Laravel Route

web.php

//web.php

Route::get('createmember','[email protected]');
Route::post('store','[email protected]');
Route::get('createmember/index','[email protected]');
Route::get('search','[email protected]');

Run Laravel 5.7 Project -> Ajax Autocomplete Textbox in Laravel 5.7 using jQuery

php artisan serve

Step #7: Store data Laravel 5.7 to the database

MemberController.php

//MemberController.php

public function store(Request $request)
    {
        $member = new \App\Member();
        $member->membername=$request->get('membername');
        $member->save();
        return redirect('createmember/index')->with('success', 'Member has been added Successfully');
    }

Step #8: Make an index page for Laravel 5.7 Search the data

resources/views/indexmember.blade.php

<!-- indexmember.blade.php -->

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Ajax Autocomplete Textbox in Laravel 5.7 using jQuery</title>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-3-typeahead/4.0.2/bootstrap3-typeahead.min.js"></script></head>
  <body>
    <div class="container">
      <h2>Laravel 5.7 AJAX Live Autocomplete Search from Database Example</h2><br/>
      @if (\Session::has('success'))
      <div class="alert alert-success">
        <p>{{ \Session::get('success') }}</p>
      </div><br />
     @endif
        <div class="row">
          <div class="col-md-4"></div>
          <div class="form-group col-md-4">
            <label for="Search">Search:</label>
            <input type="text" class="form-control" id="search" name="search">
          </div>
        </div>
    </div>
  </body>
</html>

index Methods in MemberController.php

public function index()
    {
        return view('indexmember');
    }

MemberController.php

//MemberController.php

public function result(Request  $request)
    {
        $result=\App\Member::select('membername')->where('membername', 'LIKE', "%{$request->input('query')}%")->get();
        return response()->json($result);
    }

MemberController.php

//MemberController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class MemberController extends Controller
{
    public function create()
    {
        return view('createmember');
    }
    public function store(Request $request)
    {
        $member = new \App\Member();
        $member->membername=$request->get('membername');
        $member->save();
        return redirect('createmember/index')->with('success', 'Member has been added Successfully');
    }
    public function index()
    {
        return view('indexmember');
    }
    public function result(Request  $request)
    {

        $result=\App\Member::select('membername')->where('membername', 'LIKE', "%{$request->input('query')}%")->get();
        return response()->json($result);
    }
}

Step #9: Include jQuery in the Laravel View Index File

indexmember.blade.php

<!-- indexmember.blade.php -->

<script type="text/javascript">


    var path = "{{ url('search') }}";

    $('#search').typeahead({
         minLength: 2,
        source:  function (query, process) {
        return $.get(path, { query: query }, function (data) {
            var memberlist = [];
                data.forEach(function(value){
                    memberlist.push(value.membername);
                });
                return process(memberlist);
            });
        }
    });
    </script>

indexmember.blade.php

<!-- indexmember.blade.php -->

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Laravel 5.7 - Ajax Autocomplete Textbox in Laravel 5.7 using jQuery</title>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-3-typeahead/4.0.2/bootstrap3-typeahead.min.js"></script></head>
  <body>
    <div class="container">
      <h2>Laravel 5.7 AJAX Live Autocomplete Search from Database Example</h2><br/>
      @if (\Session::has('success'))
      <div class="alert alert-success">
        <p>{{ \Session::get('success') }}</p>
      </div><br />
     @endif
        <div class="row">
          <div class="col-md-4"></div>
          <div class="form-group col-md-4">
            <label for="Search">Search:</label>
            <input type="text" class="form-control" id="search" name="search">
          </div>
        </div>
    </div>
    <script type="text/javascript">


    var path = "{{ url('search') }}";

    $('#search').typeahead({
         minLength: 2,
        source:  function (query, process) {
        return $.get(path, { query: query }, function (data) {
            var memberlist = [];
                data.forEach(function(value){
                    memberlist.push(value.membername);
                });
                return process(memberlist);
            });
        }
    });
    </script>
  </body>
</html>

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel 5.7 AJAX Live Autocomplete Search from Database Example.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

jQuery Multiple Tag Input with Dynamic Autocomplete Example 0

jQuery Multiple Tag Input with Dynamic Autocomplete Example

jQuery Multiple Tag Input with Dynamic Autocomplete Example

In this Post We Will Explain About is jQuery Multiple Tag Input with Dynamic Autocomplete Example With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Dynamic Autocomplete Tag Input Plugin For jQueryExample

In this post we will show you Best way to implement jQuery: tags input with jQuery UI Autocomplete, hear for Dynamic Autocomplete Tag Input Plugin For jQuery with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

step 1 : External Libs

bootstrap-tagsinput.js
bootstrap3-typeahead.js
bootstrap-tagsinput.css 

step 2 : index.html

<input type="text" id="category" class="formbased" data-role="tagsinput" />

step 3 : index.js

//using  typeahead scripts
$('input').tagsinput({
  typeahead: {
    source: ['live24u', 'status', 'tutorials', 'facebook search', 'free download']
  },
  freeInput: true
});
$('input').on('itemAdded', function(event) {
	//here some set timeout to call function
    setTimeout(function(){
		//just check inputbox here
        $(">input[type=text]",".bootstrap-tagsinput").val("");
    }, 1);
});

Example

I hope you have Got What is Tags using Bootstrap Tags Input Plugin with Autocomplete And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

PHP Autocomplete Input tags with Dynamic Data using jquery Ajax 0

PHP Autocomplete Input tags with Dynamic Data using jquery Ajax

PHP Autocomplete Input tags with Dynamic Data using jquery Ajax

In this Post We Will Explain About is PHP Autocomplete Input tags with Dynamic Data using jquery Ajax With Example and Demo.

Welcome on Pakainfo.com – Examples ,The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to PHP – Input multiple tags with dynamic autocomplete example

In this post we will show you Best way to implement PHP – Bootstrap autocomplete tokenfield with Ajax Example, hear for How to Dynamic Autocomplete Tag Input Plugin For jQuery with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

PHP – Bootstrap autocomplete tokenfield with Ajax Example

This jquery ajax functionality can be done simple and very easily by using ajax call jQuery here external “tagmanager” plugin for get multiple form input tags based on get all the info user selection from simple mysql with PHP based dynamic list of data.

Include Extrenal Lins

<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/tagmanager/3.0.2/tagmanager.min.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tagmanager/3.0.2/tagmanager.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-3-typeahead/4.0.1/bootstrap3-typeahead.min.js"></script>  

Database Connection(config.PHP)

    <?php
        
        $mysqli = new mysqli("localhost", "root", "[email protected]#$", "live-autocomplete");
        $myquery_sql = "SELECT sub_name FROM subjects 
                WHERE sub_name LIKE '%".$_GET['query']."%'
                LIMIT 10"; 
        $data_results = $mysqli->query($myquery_sql);
        $data = [];
        while($row = $data_results->fetch_assoc()){
             $data[] = $row['sub_name'];
        }
        echo json_encode($data);
    ?>
	
create a simple mysql table
For this example, I have a database table with all subjects :
id
sub_name

markup Languages(index.php)

Using here jquery Tag Manager plugin we can simple manage all the tags input tags uinq or separately from all the data each input with simple better layout.

    <!DOCTYPE html>
    <html>
    <head>
        <title>PHP Autocomplete Input multiple tags with Dynamic Data Load using jquery Ajax</title>
        <link rel="stylesheet" type="text/css" href="bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="tagmanager.min.css">
        <script type="text/javascript" src="3.1.1/jquery.min.js"></script>
        <script type="text/javascript" src="3.3.7/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="3.0.2/tagmanager.min.js"></script>
        <script src="4.0.1/bootstrap3-typeahead.min.js"></script>  
    </head>
    <body>
    <div class="container">
        
            <div class="form-group">
                <label>Add Subject Tags:</label>
                <input type="text" name="subjects" placeholder="choose subject...." class="typeahead tm-input form-control tm-input-info"/>
            </div>
    </div>
    <script type="text/javascript">
      $(document).ready(function() {
        var tags = $(".tm-input").tagsManager();
		//simple jquery to call a php to mysqli fetch data
        jQuery(".typeahead").typeahead({
          source: function (query, process) {
            return $.get('aj.php', { query: query }, function (data) {
              data = $.parseJSON(data);
              return process(data);
            });
          },
          afterSelect :function (item){
            tags.tagsManager("pushTag", item);
          }
        });
      });
    </script>
    </body>
    </html>

Example

I hope you have Got Bootstrap Autocomplete with Dynamic Data Load using PHP Ajax And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

Vue js Multiple Tag Input with Dynamic Autocomplete 0

Vue js Multiple Tag Input with Dynamic Autocomplete

Vue js Multiple Tag Input with Dynamic Autocomplete

In this Post We Will Explain About is Vue js Multiple Tag Input with Dynamic Autocomplete With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to autocomplete textbox with multiple values using Vue js and JSON Example

In this post we will show you Best way to implement vue js autocomplete multiple values demo, hear for autocomplete textbox using vue js from database with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Autocomplete textbox with multiple values using Vue js

In this Example,First of all Add or Inluce External Libs Like as a(jQuery, css etc..), and then create a simple index.php or index.html page.After that crate a simple javascript file like as a index.js or main.js, It is also add your web-application First Header Part to some priorty set.After that Include your relavant CSS Class.

Include External Javascript Libs

https://cdn.jsdelivr.net/vue/1.0.28/vue.js
https://cdn.jsdelivr.net/vue.multiselect/1.1.4/vue-multiselect.min.js

index.html

<div id="liveapp">
  <h3>Filters</h3>
  <multiselect :multiple="true" :hide-selected="true" :selected="selected" :options="options" :taggable="true" @tag="addTag" @update="liveupdate">
  </multiselect>
  <pre>{{$data | json}}</pre>
</div>

index.js

new Vue({
  el: '#liveapp',
  components: {
    multiselect: VueMultiselect.Multiselect
  },
  data: {
    name: 'A',
    selected: [],
    options: ['Laravel', 'PHP', 'Vuejs']
  },
  methods: {
    liveupdate: function (newSelected) {
      this.selected = newSelected
    },
    addTag: function(liveTag) {
    	this.options.push(liveTag);
    	this.selected.push(liveTag);
    }
  }
});

stayle.css

  .multiselect {
    margin-top: 5px;
    margin-bottom: 5px;
  }
  
  .form-group {
    margin-bottom: 0;
  }

You are Most welcome in my youtube Channel Please shubscibe my channel. and give me feedBackMore Details……
Angularjs Example

Example

I hope you have Got What is vue js autocomplete multiple values demo And how it works.I would Like to have FeaeBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

Laravel Autocomplete Textbox with Multiple values using jQuery and MySQL 0

Laravel Autocomplete Textbox with Multiple values using jQuery and MySQL

Laravel Autocomplete Textbox with Multiple values using jQuery and MySQL

In this Post We Will Explain About is Laravel Autocomplete Textbox with Multiple values using jQuery and MySQL With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Laravel – Input multiple tags with dynamic autocomplete Example

In this post we will show you Best way to implement Laravel – Autocomplete Multiple Fields, hear for Laravel 5 – Simple Autocomplete Multiple values Using jQuery, Ajax and MySQL with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Step 1: Make Sample Table

In first Phase, We will create some sample table Like as a “students” to test this spource code.

CREATE TABLE `students` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `stud_sname` varchar(3) NOT NULL,
 `name` varchar(150) NOT NULL,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=247 DEFAULT CHARSET=utf8

Step 2: Add routes

In this Simple Phase, We will add the simple following two Laravel routes :

Route::get('autocomplete', '[email protected]');

Route::get('searchajax', ['as'=>'searchajax','uses'=>'[email protected]']);

Step 3: Create Controller

In this Phase, We will Make studentNameListController.php in following path Laravel web-application like as a app/Http/Controllers.

app/Http/Controllers/studentNameListController.php

<?php

//include Name Space
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class studentNameListController extends Controller
{
    public function index(){        
        return view('autocomplete');
    }
    public function searchResponse(Request $request){
        $query = $request->get('term','');
        $students=\DB::table('students');
        if($request->type=='studentname'){
            $students->where('name','LIKE','%'.$query.'%');
        }
        if($request->type=='student_code'){
            $students->where('stud_sname','LIKE','%'.$query.'%');
        }
           $students=$students->get();        
        $data=array();
        foreach ($students as $student) {
                $data[]=array('name'=>$student->name,'stud_sname'=>$student->stud_sname);
        }
        if(count($data))
             return $data;
        else
            return ['name'=>'','stud_sname'=>''];
    }
}

Step 4: Create View File

Last Phase We will make a simple file like as a autocomplete.blade.php in following path Laravel web-application resources/views/.

<!DOCTYPE html>
<html>
<head>
    <title>Laravel Autocomplete Textbox with Mutiple values using jQuery and MySQL</title>
    <link rel="stylesheet" type="text/css" href="bootstrap.min.css">
  <link rel="stylesheet" type="text/css" href="1.12.1/jquery-ui.min.css">
    <script src="jquery-3.2.1.min.js"></script>
  <script src="1.12.1/jquery-ui.min.js"></script>
</head>
<body>
<!-- Devloped by Pakainfo.com free download examples -->
<div class="container">
  <h1>Laravel Autocomplete Textbox with Mutiple values using jQuery and MySQL</h1>
  {!! Form::open() !!}
<!-- Devloped by Pakainfo.com free download examples -->      
    <table class="table table-bordered">
      <tr>
          <th><input class='check_all' type='checkbox' onclick="all_student()"/></th>
          <th>S. No</th>
          <th>Student Name</th>
          <th>Student code</th>
      </tr>
      <tr>
          <td><input type='checkbox' class='chkbox'/></td>
          <td><span id='sn'>1.</span></td>
          <td><input class="form-control liveAuto_txt" type='text' data-type="studentname" id='studentname_1' name='studentname[]'/></td>
          <td><input class="form-control liveAuto_txt" type='text' data-type="student_code" id='student_code_1' name='student_code[]'/> </td>
        </tr>
      </table>
      <button type="button" class='btn btn-danger delete'>- Delete</button>
      <button type="button" class='btn btn-success addbtn'>+ Add More</button>
  {!! Form::close() !!}
</div>
<script type="text/javascript">
          
 $(".delete").on('click', function() {
  $('.chkbox:checkbox:checked').parents("tr").remove();
  $('.check_all').prop("checked", false); 
  studentUpdateId();
});
var i=$('table tr').length;
$(".addbtn").on('click',function(){
  count=$('table tr').length;
  
    var data="<tr><td><input type='checkbox' class='chkbox'/></td>";
      data+="<td><span id='sn"+i+"'>"+count+".</span></td>";
      data+="<td><input class='form-control liveAuto_txt' type='text' data-type='studentname' id='studentname_"+i+"' name='studentname[]'/></td>";
      data+="<td><input class='form-control liveAuto_txt' type='text' data-type='student_code' id='student_code_"+i+"' name='student_code[]'/></td></tr>";
  $('table').append(data);
  i++;
});
        
function all_student() {
  $('input[class=chkbox]:checkbox').each(function(){ 
    if($('input[class=check_all]:checkbox:checked').length == 0){ 
      $(this).prop("checked", false); 
    } else {
      $(this).prop("checked", true); 
    } 
  });
}
function studentUpdateId(){
  obj=$('table tr').find('span');
  $.each( obj, function( key, value ) {
    id=value.id;
    $('#'+id).html(key+1);
  });
}
//Live autocomplete script
$(document).on('focus','.liveAuto_txt',function(){
  type = $(this).data('type');
  
  if(type =='studentname' )autoType='name'; 
  if(type =='student_code' )autoType='stud_sname'; 
  
   $(this).autocomplete({
       minLength: 0,
       source: function( request, response ) {
            $.ajax({
                url: "{{ route('searchajax') }}",
                dataType: "json",
                data: {
                    term : request.term,
                    type : type,
                },
                success: function(data) {
                    var array = $.map(data, function (stud) {
                       return {
                           label: stud[autoType],
                           value: stud[autoType],
                           data : stud
                       }
                   });
                    response(array)
                }
            });
       },
       select: function( event, ui ) {
           var data = ui.stud.data;           
           id_arr = $(this).attr('id');
           id = id_arr.split("_");
           paramId = id[id.length-1];
           $('#studentname_'+paramId).val(data.name);
           $('#student_code_'+paramId).val(data.stud_sname);
       }
   });
   
   
});
</script>
<!-- Devloped by Pakainfo.com free download examples -->
</body>
</html>

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 Laravel autocomplete multiple fields with single auto-select request And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.