Uhh. let's an example...
This is the PHP code: index.php :->
<?php
// Starter tags
echo "<input name='name' value='name'> </input>";
?>
And this is the database table structure :
|------------|------------------|---------------------------------------|
| Name | Email | Description |
|------------|------------------|---------------------------------------|
|John Doe | john@doe.com | John Doe is example person |
| | | |
|Rishikesh | risht@dot.com | Rishikesh is FnCEO of Pupoz |
|------------|------------------|---------------------------------------|
How to write a jQuery code so that it asks PHP to execute a MySQL Query and give suggestions to select while typing. And that input box should be on the PHP page. Please add your own name if you can and I will try that later on. Thanks if you can help me.
I have some doubts. And will ask the questions later.
use Jquery UI AutoComplete, it can be used with Remote datasource, An Array of data. it has many options such as modal, styles. JqueryAutocomplete
<div id="SomeID"> <input type="text" id="SomeTextID"/></div>
Jquery.
$(function(){
$( "#SomeTextID" ).autocomplete({
source: "YourPhpPage.php",
minLength: 2,
select: function( event, ui ) {
log( ui.item ?
"Selected: " + ui.item.value + " aka " + ui.item.id :
"Nothing selected, input was " + this.value );
}
});
});
see Demo : JSFiddle AutoCompleter