Hallo,
habe ein Suchformular erstellt das sieht so aus:
Dazu die DB-Abfrage sieht so aus:
Aber irgendwas ist da falsch, weill wennich im Suchformular eine oder mehere Leistungen auswähle werden diese gar nicht berücksichtigt. Wieso nicht?
Gruß MediCo
habe ein Suchformular erstellt das sieht so aus:
PHP:
<form method="POST" action="search.php">
<p align="center">&</p>
<div align="center">
<table border="0" id="table18">
<tr>
<td>
<p align="center"><b><font face="Verdana">Wählen Sie
Ihre gewünschte Kategorie:</font></b></p>
<p align="center"><b><font face="Verdana" size="1">&</font></b><select size="1" name="kategorie_suche">
<option value="">Alle</option>
<option>Kategorie1</option>
<option>Kategorie2</option>
<option>Kategorie3</option>
<option>Kategorie4</option>
<option>Kategorie5</option>
<option>Kategorie6</option>
</select></p></td>
</tr>
<tr>
<td>
<p align="center"><b>Suche einschränken mit</b></p>
<p align="center"><font size="1"><b>&</b></font><font face="Verdana"><font size="2">PLZ </font>
<input type="text" name="plz_suche" size="5"><font size="2"> Ort
</font><input type="text" name="ort_suche" size="20"></font></p>
</td>
</tr>
<tr>
<td><p align="center"><b><font face="Verdana" size="2">Gewünschte
Leistungen:</font><font face="Verdana" style="font-size: 5pt">
</font></b></p>
<div align="center">
<table border="0" id="table19">
<tr>
<td><font face="Verdana">
<input type="checkbox" name="leistung_1" value="1"></font></td>
<td><font face="Verdana">Leistung 1</font></td>
<td><font face="Verdana">
<input type="checkbox" name="leistung_2" value="1"></font></td>
<td><font face="Verdana">Leistung 2</font></td>
</tr>
<tr>
<td><font face="Verdana">
<input type="checkbox" name="leistung_3" value="1"></font></td>
<td><font face="Verdana">Leistung 3</font></td>
<td><font face="Verdana">
<input type="checkbox" name="leistung_4" value="1"></font></td>
<td><font face="Verdana">Leistung 4
</font></td>
</tr>
<tr>
<td><font face="Verdana">
<input type="checkbox" name="leistung_5" value="1"></font></td>
<td><font face="Verdana">Leistung 5</font></td>
<td><font face="Verdana">
<input type="checkbox" name="leistung_6" value="1"></font></td>
<td><font face="Verdana">Leistung 6
</font></td>
</tr>
<tr>
<td><font face="Verdana">
<input type="checkbox" name="lesitung_7" value="1"></font></td>
<td><font face="Verdana">Leistung 7</font></td>
<td><font face="Verdana">
<input type="checkbox" name="leistung_8" value="1"></font></td>
<td><font face="Verdana">Leistung 8</font></td>
</tr>
<tr>
<td><font face="Verdana">
<input type="checkbox" name="leistung_9" value="1"></font></td>
<td><font face="Verdana">Leistung 9</font></td>
<td><font face="Verdana">
<input type="checkbox" name="leistung_10" value="1"></font></td>
<td><font face="Verdana">Leistung 10</font></td>
</tr>
<tr>
<td><font face="Verdana">
<input type="checkbox" name="leistung_11" value="1"></font></td>
<td><font face="Verdana">Leistung 11</font></td>
<td><font face="Verdana">
<input type="checkbox" name="leistung_12" value="1"></font></td>
<td>
<p align="center"><font face="Verdana">
Leistung 12</font></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
<p align="center"><font face="Verdana">Stichwortsuche
<input type="text" name="wort_suche" size="20"></font></p>
<p align="center"><font face="Verdana">
<input type="submit" value="Absenden" name="B1"><input type="reset" value="Zurücksetzen" name="B2"></font></p>
</form>
Dazu die DB-Abfrage sieht so aus:
PHP:
<?
$result = mysql_query("SELECT * FROM tabelle WHERE kategorie LIKE '%$kategorie_suche%' AND plz LIKE '$plz_suche%' AND ort LIKE '$ort_suche%'
AND name LIKE '$wort_suche%' OR str LIKE '$wort_suche%' AND leistung1 LIKE '$leistung_1' AND leistung2 LIKE '$leistung_2'
AND leistung3 LIKE '$leistung_3' AND leistung4 LIKE '$leistung_4' AND leistung5 LIKE '$leistung_5' AND leistung6 LIKE '$leistung_6'
AND leistung7 LIKE '$leistung_7' AND leistung8 LIKE '$leistung_8' AND leistung9 LIKE '$leistung_9' AND leistung10 LIKE '$leistung_10'
AND leistung11 LIKE '$leistung_11' AND leistung12 LIKE '$leistung_12' ORDER BY anzeigentyp DESC, plz ASC",$db);
?>
Aber irgendwas ist da falsch, weill wennich im Suchformular eine oder mehere Leistungen auswähle werden diese gar nicht berücksichtigt. Wieso nicht?
Gruß MediCo