daily pastebin goal
29%
SHARE
TWEET

Untitled

a guest Feb 20th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <input type="text" id="demo-input-prevent-duplicates" name="targ_country" />
  2.  <script type="text/javascript">
  3.     $(document).ready(function() {
  4.         var host = window.location.protocol+"//"+window.location.hostname;
  5.         jQuery("#demo-input-prevent-duplicates").tokenInput(host+"/forms/campaign_location.php?action=country", {
  6.         preventDuplicates: true,
  7.         theme: "facebook",
  8.         crossDomain: true
  9.     });
  10.     });
  11. </script>
  12.    
  13. <?php
  14. if( isset( $_GET['action'] ) && isset( $_GET['q'] ) ) {
  15.  
  16.     $search = $db->clean( $_GET['q'] );
  17.     $query = sprintf("SELECT CountryId, Country from countries WHERE Country LIKE '%%%s%%' ORDER BY Country DESC LIMIT 10", mysql_real_escape_string($_GET["q"]));
  18.     $result = array();
  19.     $rs = mysql_query($query) or die( mysql_error() );
  20.  
  21.     while( $row = mysql_fetch_object( $rs ) ) {
  22.         $result[] = $row;
  23.     }
  24.  
  25.     # JSON-encode the response
  26.     $json_response = json_encode($result);
  27.  
  28.     if($_GET["callback"]) {
  29.         $json_response = $_GET["callback"] . "(" . $json_response . ")";
  30.     }      
  31.     echo $json_response;
  32. }
  33. ?>
  34.    
  35. propertyToSearch: "Country"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top