<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery.autocomplete.js"></script> <script type="text/javascript" src="jquery-1.3.2.min.js"></script> <script> $(document).ready(function(){ $("#tag").autocomplete("autocomplete.php", { selectFirst: true }); }); </script> <script> $(document).ready(function() { $("#city").change(function(){ var city = $("#city").val(); $("#stage").load('autocomplete.php', {"city":city} ); }); }); </script> </head> <body> <div>Select City</div> <select id="city" name="city"> <option value="select">Select</option> <option value="Chennai">Chennai</option> <option value="Madurai">Madurai</option> <option value="Salem">Salem</option> <option value="Trichy">Trichy</option> </select><br /> <input type="text" id="tag" class="tag" size="20" /><br /> <div id="stage"> </div> </form> </body> </html>
<?php if($_REQUEST["city"]) { $city = $_REQUEST['city']; } ?> <?php echo $city; $q=$_GET['q']; $my_data=mysql_real_escape_string($q); $mysqli=mysql_connect('localhost', 'root', ''); if (!$mysqli) { die('Could not connect: ' . mysql_error()); } if(!mysql_select_db("details")) { die('Could not connect database: ' . mysql_error()); } $sql="SELECT localty FROM localty where localty like '%$my_data%' and city='$city'"; $result = mysql_query($sql); if($result) { while($row=mysql_fetch_array($result)) { echo $row['localty']."\n"; } } ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)