SHARE
TWEET

helping-someone-out

a guest Feb 4th, 2015 573 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. A few people have asked how to add multiple form fields and search to separate databases.
  2.  
  3. You can create 2 search files checking different databases/tables etc.
  4. so search.php and search2.php
  5.  
  6. Then put this into the head of the page you have your form on replacing the "name of person" with what ever the name of 1 of your form field is and do the same for "city" to what ever other form field you want to search for.
  7.  
  8.  <script>
  9.     $(document).ready(function(){
  10.     $('input.nameofperson').typeahead({
  11.         name: 'nameofperson',
  12.         remote:'search.php?key=%QUERY',
  13.         limit : 10
  14.     });
  15.     $('input.city').typeahead({
  16.         name: 'city',
  17.         remote:'search2.php?key=%QUERY',
  18.         limit : 10
  19.     });
  20. });
  21.     </script>
  22.  
  23. now make sure that the "name" and the "class" for each form field match 1 of the above.
  24.  
  25. <input type="text" name="nameofperson" class="nameofperson tt-query" autocomplete="off" spellcheck="false" placeholder="Type name of person">
  26.  
  27. and for the second field:
  28.  
  29. <input type="text" name="city" class="city tt-query" autocomplete="off" spellcheck="false" placeholder="Type name of person">
  30.  
  31. Hope this helps and makes sense to anyone  :)
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