You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 2, 2018. It is now read-only.
i have two input field, the first have autocomplete with cities names, I need to set the second field zone, with autocomplete filtered by selected city... i tried this but dont work...
$("#zone").focus(function(){
var c = $('#city').val();
$('#zone').autocomplete({
source: '/auto_q_int.php?city=' + c
});
});
auto_q_int.php is:
class Autocomplete
{
public $term;
public $conn;
public function __construct()
{
$this->dbConnect();
$this->term = mysql_real_escape_string($_GET['term']);
}
private function dbConnect()
{
$this->conn = mysql_connect(HOST,USER,PASSWORD) OR die("connection failed");
mysql_select_db(DB, $this->conn) OR die("no db selected");
}
public function printResult()
{
$sql = "SELECT zone
FROM zones
WHERE zone LIKE '%$this->term%' && id = '$_GET[city]'
ORDER BY zone ASC";
$res = mysql_query($sql, $this->conn);
$return = array();
$arr = array();
while($row = mysql_fetch_array($res))
{
array_push($return, $arr);
}
echo json_encode($return);
}
}
$autocomplete = new Autocomplete();
$autocomplete->printResult();
some help please?
The text was updated successfully, but these errors were encountered:
i have two input field, the first have autocomplete with cities names, I need to set the second field zone, with autocomplete filtered by selected city... i tried this but dont work...
$("#zone").focus(function(){
var c = $('#city').val();
$('#zone').autocomplete({
source: '/auto_q_int.php?city=' + c
});
});
auto_q_int.php is:
{
public $term;
public $conn;
}
$autocomplete = new Autocomplete();
$autocomplete->printResult();
some help please?
The text was updated successfully, but these errors were encountered: