jeudi 16 avril 2015

Tie PHP Search with Form Options Selection

How can I integrate search results from as the example picture shows? Right now I have :



if(isset($_POST['q'])) {

$q = $_POST['q'];

$select = $db->query("SELECT * FROM customers WHERE FName LIKE '%$q%' OR

LName LIKE '%$q%' ORDER BY ID DESC");

//Search Form Box
<form method="post">
<input type="text" name="q" /> <input type="submit" name="search" />
</form>


My desired end result is being able to type in a form search field, after the first 3 characters are typed, have the form be selectable and populate from my "items" database table, and be selectable. The I want to be able to dynamically add extra form fields(so the user can add items to an invoice). Example


Autocomplete code :



'$(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$( "#tags" ).autocomplete({
source: availableTags
});
});'


I cannot see how autocomplete would work, with the limited tags code.


Aucun commentaire:

Enregistrer un commentaire