I currently have a search engine that links to my database and returns suggestions based on what you type (as long as it is longer than 2 characters). However, as it currently stands, the suggestions are simply text in a div. How can I make them able to be selected (by arrow keys and the mouse) and clickable so that they link to the respective search results page? k refers to search input. Thanks in advance.
<?php
if (isset ($_GET['k'])) {
    $k = $_GET['k'];
}
if (strlen($k) > 2) {
    if (!empty ($k)) {
        if (@mysql_connect('hostname', 'root', 'password')) {
            if (@mysql_select_db('search')) {
                $query = ("SELECT title FROM search WHERE title LIKE '%".mysql_real_escape_string($k)."%'");
                $query_run = mysql_query($query);
                while ($query_row = mysql_fetch_assoc($query_run)) {
                    echo $keywords = $query_row['title'].'<br>        <hr>';
                }
            }
        }
    }
}
?>
