Hallo Leute!
Ich komm einfach nicht dahinter wie man bei einem Formular mit zwei <select> Felder eine Datenbank abruft.
Ich bin in PHP noch ein Frischling bitte helft mir.
Bis jetzt habe ich:
formular-><form name="abfrage" action="firmen.php" method="POST">
<select name="land">
<option>Treffen Sie eine Auswahl</option>
<option value="Land1">Land1 </option>
<option value="Land2">Land2 </option>
</select>
<select name="branche">
<option>Treffen Sie eine Auswahl</option>
<option value="Branche1">Branche1 </option>
<option value="Branche2">Branche2 </option>
</select>
</form>
<?
if (isset($_POST['land'])) {
$land ="land = '{$_POST['land']}'";
}
if (isset($_POST['branche'])) {
$land ="branche = '{$_POST['branche']}'";
}
$sql = "SELECT * FROM firmen WHERE ($land) AND ($branche) order by name";
$result = mysql_query($sql);
if ($result) {
while ($row = mysql_fetch_array ($result)){
$land=htmlentities($row['land']);
$branche=htmlentities($row['branche']);
echo " $land $branche";
}
}
?>
Danke in voraus für die Hilfe
lg kati
Datum: 01.10.2005-10:31
