slaterino Posted August 28, 2008 Share Posted August 28, 2008 Hi, I am having my first foray into the world of AJAX and Javascript and have created an Autosuggest search page. However, I want to have a submit button that will list all database entreies that match the search query and I can't work out what the best way to do this! Would it be using a input button and some kind of onClick fucntion? If so, does anyone know what the onClick function would be in jQuery? Would I need to create some new script for this? If anyone can give me any guidance on this I will be eternally grateful. Here is the code: <?php $db = new mysqli('128.0.0.1', 'asad' ,'asad', 'asad'); if(!$db) { echo 'ERROR: Could not connect to the database.'; } else { if(isset($_POST['queryString'])) { $queryString = $db->real_escape_string($_POST['queryString']); if(strlen($queryString) >0) { $query = $db->query("SELECT DISTINCT OrgType FROM Contacts WHERE OrgType LIKE '$queryString%' LIMIT 10"); if($query) { while ($result = $query ->fetch_object()) { echo '<li onClick="fill(\''.$result->OrgType.'\');">'.$result->OrgType.'</li>'; } } else { echo 'ERROR: There was a problem with the query.'; } } else { } } else { echo 'There should be no direct access to this script!'; } } ?> Quote Link to comment Share on other sites More sharing options...
haku Posted August 29, 2008 Share Posted August 29, 2008 jquery onclick = click() http://visualjquery.com/1.1.1.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.