i am trying to create a Ajax live search for my website. I currently can query the database for titles and display them under my search (See Fig 1.0) however i need to make them selectable so that when you do select them, it will set the input value to that title, very much like on wikipdia search Wikipedia Search. The wikipedia example is basicly what I am looking for. Any help would be great.
Thanks, CHL UK
My Search so far http://www.webquark.co.uk/Search.bmp
Fig 1.0
CODE: PHP DB search
<?
// Get value coming from request
$search = mysql_real_escape_string ($_GET['search']);
// Connect to DB
mysql_connect("localhost", "****", "****") or die(mysql_error()) ;
mysql_select_db("*****") or die(mysql_error()) ;
$result = mysql_query("SELECT * FROM dbArticle WHERE title LIKE '%$search%' OR type LIKE '%$search%' OR username LIKE '%$search%'");
while($row = mysql_fetch_array($result))
// Check if name exists in table
if (!empty($row['title'])) {
echo "".$row['title']."<br />";}
if (!empty($row['type'])) {
echo "".$row['type']."<br />";}
if (!empty($row['username'])) {
echo "".$row['username']."<br />";}
//Close connection
mysql_close();
?>
CODE:PHP Search Input
<div id="navSearch">
<form method="post" action="index.php?pageContent=search">
<li><input type="text" maxlength="30" size="22" name="search" onkeyup="send_requestSearch(this);"/> </li>
<li><input type="submit" value="Search" name="submit"/></li>
<div class="liveSearch" id="livesearch"></div>
</form>
If you need to see my Javascript let me know.