Thread: Filter

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    16
    Rep Power
    0

    Filter


    Sir I am using these codes

    PHP Code:
    <div id="search">
            <label for="filter">Filter</label> <input type="text" name="filter" value="" id="filter" />
    </div>   
    <br /> 
                <table cellpadding="2" cellspacing="0" width="90%" id="resultTable">
              <thead>
                <tr>
                  <th> <strong>ID</strong> </th>
                  <th> <strong>Name</strong> </th>
                  <th> <strong>Mobile</strong> </th>
                  <th> <strong>City</strong> </th>
                  <th> <strong>Country</strong> </th>
                </tr>
              </thead>
              <tbody>
    <?php
    $sql 
    "SELECT * from contacts order by name" ;
    $select mysqli_query($con$sql);
    $run_sel mysqli_fetch_array($select);
    $row=mysqli_num_rows($select);
    //echo ($row);
    $a 1;
    while(
    $a<=$row)
    {
        echo 
    "<tr>";
        echo 
    "<td> <a href='contacts.php?id=".$run_sel['id']."'>
        <img border=\"noborder\" src=\"images/pencil.png\" title=\"Display\"></a></td>"
    ;
        echo 
    "<td align='left'> " $run_sel["name"].  "</td>";
        echo 
    "<td> " $run_sel["moba"]. "</td>";
        echo 
    "<td> " $run_sel["city"]. "</td>";
        echo 
    "<td> " $run_sel["country"] . "</td>";
        echo 
    "</tr>";
        
    $run_sel mysqli_fetch_array($select);
        
    $a++;
        
    }
    ?>
            </tbody>
           </table>
    These codes display following data


    Now I want to apply incremental search with Filter box.

    For example:

    If I type "B" then all matching records (name field in table) which begins with "B" must appear in display list.

    Please help
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,294
    Rep Power
    9400
    What have you tried? Tried anything? Maybe you don't know where to start?

    We're not going to just give you the answer. We'll help you figure it out, but we have to know what you've done by yourself.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Dec 2004
    Posts
    3,027
    Rep Power
    377
    look at JQUERY/AJAX or jquery's autosuggest/pre-populate demo which will do what you want.
  6. #4
  7. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    He/she/it frequently posts a “This is what I need” request into every big web programming forum. I guess it's a special form of outsourcing.
    The 6 worst sins of securityHow to (properly) access a MySQL database with PHP

    Why can’t I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    16
    Rep Power
    0
    Dear Jacques1,
    Do not miss any chance to insult me, anytime, anywhere.

    Continue this good job.

    Comments on this post

    • requinix agrees

IMN logo majestic logo threadwatch logo seochat tools logo