ERLEDIGT
NEIN
NEIN
ANTWORTEN
0
0
ZUGRIFFE
178
178
EMPFEHLEN
-
Hi Leute,
ich werde hier langsam verrückt.
Ich weiß nicht genau, wie ich die Ergebnisse meiner Livesuche, welche unter dem Textfeld als Liste ausgegeben werden, bei Mausklick in das Textfeld einfügen lassen kann.
autocompletePLZ.php
PHP-Code:<?php
$db = new mysqli('', '' ,'', '');
if(!$db) {
} else {
if(isset($_POST['plz'])) {
$plz = $db->real_escape_string($_POST['plz']);
if(strlen($plz) >0) {
$query = $db->query("SELECT PLZ FROM T_Firma WHERE PLZ LIKE '$plz%' LIMIT 10");
if($query) {
while ($result = $query ->fetch_object()) {
echo '<li style="list-style-type:none; onClick="fillPLZ(\''.$result->PLZ.'\');">'.$result->PLZ.'</li>';
}
}
else {
}
}
else {
}
} else {
}
}
?>
autocomplete.js
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
function lookupPLZ(inputStringPLZ) { if(inputStringPLZ.length == 0) { $('#suggestionsPLZ').hide(); } else { $.post("autocompletePLZ.php", {plz: ""+inputStringPLZ+""}, function(data){ if(data.length >0) { $('#suggestionsPLZ').show(); $('#autoSuggestionsListPLZ').html(data); } } ); } } function fillPLZ(thisValue) { document.suche.plz.value = $('#inputStringPLZ').val(thisValue);; setTimeout("$('#suggestionsPLZ').hide();", 200); }
index.php
HTML-Code:<form align="center" name="suche" action="index.php?site=suche.php" accept-charset="iso-8859-1" method="post"> <input type="text" name="plz" value="PLZ" onClick="javascript:resetFieldPLZ()" id="inputStringPLZ" onkeyup="lookupPLZ(this.value);" onblur="fillPLZ();" /> <div class="suggestionsBoxPLZ" id="suggestionsPLZ" style="display: none;"> <div class="suggestionListPLZ" id="autoSuggestionsListPLZ">
ich wäre euch sehr dankbar, wenn ihr mir da helfen könntet
Gruß
Sonny
Ähnliche Themen
-
Livesuche und deren Suchworte
Von xxxmike im Forum PHPAntworten: 5Letzter Beitrag: 11.05.10, 08:54 -
<select> Livesuche
Von jans2 im Forum Javascript & AjaxAntworten: 3Letzter Beitrag: 03.12.09, 09:35 -
AJAX - Livesuche
Von 22hase im Forum Javascript & AjaxAntworten: 4Letzter Beitrag: 15.12.08, 15:02 -
Livesuche in Tabellen
Von bronco_user im Forum Javascript & AjaxAntworten: 4Letzter Beitrag: 06.03.08, 23:03 -
(Livesuche) Fehler, und ich weiss nicht wieso..
Von Suchfunktion im Forum Javascript & AjaxAntworten: 0Letzter Beitrag: 01.11.06, 10:17





Zitieren
Login





