Reputation:
I create auto complete but its source coming from javascript, now i want to get source from mysql database using php language.Below is my script, Please help me
<SCRIPT language="javascript">
$(document).ready(function() {
$("input#autocomplete").autocomplete({
source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
});
});
</SCRIPT>
Upvotes: 0
Views: 545
Reputation: 14187
Hope this helps, this is an example i made using php and mysql, you can download it from here:
http://dl.dropbox.com/u/15208254/trickylearning/examples/autocomplete/autocomplete-php.zip
Than main idea of this example is to have something with this structure in your db:
And the final result will split everything from db and look like this:
Regards.
Upvotes: 1
Reputation: 1186
you can chage this <td width="249"><input type="text" name="name[]"/></td>
to <td width="249"><input type="text" class="xyz" name="name[]"/></td>
and in jquery use $(".xyz").autocomplete({})
;
Upvotes: 0