Advertisement
Guest User

AJAX Autocomplete - call.php

a guest
Dec 23rd, 2011
715
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.     Simple Autocomplete
  5.     call.php
  6.     by Intrepid
  7. */
  8.  
  9.  
  10. $list = array(
  11.     "Autocomplete",
  12.     "AJAX is fun!",
  13.     "Alphabeth",
  14.     "Alphanumeric",
  15.     "Bravo",
  16.     "Charlie",
  17.     "Connection",
  18.     "Delta",
  19.     "Echo",
  20.     "Internetprotocol",
  21.     "IP-Address",
  22.     "Geo-IP",
  23.     "GPU",
  24.     "CPU",
  25.     "Foxtrott",
  26.     "Tango",
  27.     "Torpedo",
  28.     "TCP-Protocol",
  29.     "Shark",
  30.     "Shakespeare",
  31.     "Speed",
  32.     "South",
  33.     "So",
  34.     "X-Ray",
  35.     "Yankee",
  36.     "Zulu",
  37.     "Monkey",
  38.     "Mike",
  39.     "Microphone",
  40.     "Metapher",
  41.     "Metatag");
  42.  
  43. for($i=0; $i<count($list); $i++){
  44.     if(strpos($list[$i], $_GET['str']) !== FALSE && strlen($_GET['str']) >= 2){
  45.         echo str_ireplace($_GET['str'], '<b style="color: red;">'.$_GET['str'].'</b>', $list[$i]) . '<br>';
  46.     }
  47. }
  48.  
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement