I have this structure:
$(function($) {
$( "#cliente" ).autocomplete({
source: '../php/search_clientes.php'
});
});
<div class="form-group">
<div class="row">
<div class="col-sm-12">
<input type="text" value="" name="cliente" id="cliente" tabindex="1" class="form-control" placeholder="Pesquisar">
</div>
</div>
</div>
Where "search_clients.php" is:
<?php
/******* Conexão com o bando de dados *******/
include "../../Conexao/config.php";
mysqli_select_db($config, $database_config);
mysqli_set_charset($config,"utf8");
/******* Conexão com o bando de dados *******/
//get search term
$searchTerm = $_GET['term'];
$sql_1 = mysqli_query($config, "SELECT * FROM tb_agenda WHERE nome_razao LIKE '%".$searchTerm."%' AND tipo_contato = '12' ORDER BY nome_razao ASC LIMIT 10") or die(mysqli_error($config));
if(@mysqli_num_rows($sql_1) <= '0'){
//echo "$erro";
}else{
while($r_sql_1 = mysqli_fetch_array($sql_1)){
$cliente = $r_sql_1['nome_razao'];
$data[] = $cliente;
}
}
//return json data
echo json_encode($data);
?>
Is it possible, some way to bring the id into some hidden input, or bring the PHP id somehow?
I found this, but after a day of trying, I assume I need help.