В форме есть formgroup:
<div class="form-group">
<label class="control-label">найти<star/>*</star></label>
<input class="form-control" name="mark" id="mark" required="true" type="text"/>
</div>
В конце файла обработчик:
<script>
$( function() {
$( "#mark" ).autocomplete({
source: "newJob-search.php",
minLength: 2,
select: function( event, ui ) {
var client = ui.item.label;
var clientID = ui.item.value1;
var cardName = ui.item.value2;
$('#mark').val(ui.item.label;);
}
});
} );
</script>
php обработчик:
<?
$conn = mysql_connect("localhost", "root", "");
mysql_select_db("sql", $conn);
$q = mb_strtolower($_GET["term"], "UTF-8");
$return = array();
$query = mysql_query("select clientFIO,id,cardName from clients where clientFIO like '%$q%'");
while ($row = mysql_fetch_array($query)) {
array_push($return, array(
'label' => $row['clientFIO'],
'value1' => $row['id'],
'value2' => $row['cardName']
));
}
echo (json_encode($return));
?>