PHP: Autofilter and form population?

Discussion in 'PHP' started by nes_jr429, Mar 11, 2013.

  1. #1
    Hello everyone, I am having a problem with my sidebar. The scenario is this, I have form on the page and then i have a left sidebar with input element(search box) and a table element. The table serves as a container of all records from the database (specifically it will only show up the first name and last name). So what I really want is to put a something autofilter on the table, everytime I type a character/s on the input box, It will automatically filter the table. And the major thing here is when I click a certain record on the table, it will automatically populate on the form fields. Is it possible to happen? I will appreciate all your replies. Thanks. :)
     
    nes_jr429, Mar 11, 2013 IP
  2. nes_jr429

    nes_jr429 Member

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #2
    http://demos.flexpointoutsourcing.com/s4s-odfl/admin-patient.php

    By the way this is link...
     
    nes_jr429, Mar 11, 2013 IP
  3. D3Tek

    D3Tek Active Member

    Messages:
    164
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    50
    #3
    I believe this is what you're looking for; http://jqueryui.com/autocomplete/

    I can't put together some code because I don't know your database setup, obviously.
    Hope this helps though, the code is really straightforward!
     
    D3Tek, Mar 11, 2013 IP
  4. nes_jr429

    nes_jr429 Member

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #4
    Hi thanks for the reply, I think this one could really help me but how could I implement it on my form population? I mean how could I put php script in this js? Could I add up on this one?
     
    nes_jr429, Mar 11, 2013 IP
  5. D3Tek

    D3Tek Active Member

    Messages:
    164
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    50
    #5
    Well, you could add your PHP here:

    
     
     var availableTags = [
          "ActionScript",
          "AppleScript",
          "Asp",
          "BASIC",
          "C",
          "C++",
          "Clojure",
          "COBOL",
          "ColdFusion",
          "Erlang",
          "Fortran",
          "Groovy",
          "Haskell",
          "Java",
          "JavaScript",
          "Lisp",
          "Perl",
          "PHP",
          "Python",
          "Ruby",
          "Scala",
          "Scheme"
        ];
    Code (markup):

    Select the data you want to search, run it through a loop and comma delimiter it
     
    D3Tek, Mar 11, 2013 IP
  6. nes_jr429

    nes_jr429 Member

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #6
    ok it is clear now, but I have one more question, let say I already put the script there and then how could I add onclick event on the data that will get the id and will trigger to the database and fetch the records from it based on the selected data and will populate the records to the form fields? I'm really sorry I'm a just new to programming, thank u very much.. :)
     
    nes_jr429, Mar 11, 2013 IP