I'm trying to make an Ajax search form - This form will simply search the database for names.
The table design is as follows:
id name 开发者_JAVA技巧age
1 some name 10
2 some name2 11
3 some name3 12
Each name is associated with a unique ID.
I want to create a drop down menu of top hits when the user enters their search string.
Also, somehow in the background i would like to retrieve the associated ID with each result as well. That ID will be POST'ed to a form say
myform.php
Now, my question is as follows:
1) How do i create the drop down menu? I believe i can follow this tutorial and simply customise it to create a drop down menu. http://www.w3schools.com/ajax/ajax_aspphp.asp This would be fairly simple.
2) The main question is, how do i keep track of the ID and selected name, so that i can POST that ID to myform.php
Thanks.
<select name="carlist">
<option value="id">name</option>
</select>
Keep id and name like this.
on posting id is posting , you can get name from id .
I hope this is what you are asking.
But i dont find drop down in that link you provide
精彩评论