Hallo
Ich kenne die Grundlagen von PHP/Mysql und habe mir zum Ziel gesetzt mit Dreamweaver "mal schnell" ein Hotelverzeichnis auf die Beine zu stellen.
Mit meinen Grundlagen und Dreamweaver hoffe ich, dass ich das hinkriege... Nur leider habe ich grad ein kleines Problem:
Mein Formular:
HTML-Code:
<form action="index.php" method="get" name="hotelsuche">
<p>
<select name="land_allhotels" id="land_allhotels">
<option value="ch">ch</option>
<option value="d">d</option>
<option value="a">a</option>
</select>
</p>
<p>
<input type="submit" name="Submit" value="Senden">
</p>
</form>
mein Suchscript in diesem Fall noch index.php:
PHP-Code:
<?php require_once('Connections/db_hotel.php'); ?>
<?php
$land_allhotels = "1";
if (isset($_POST['$land'])) {
$land_allhotels = (get_magic_quotes_gpc()) ? $_POST['$land'] : addslashes($_POST['$land']);
}
mysql_select_db($database_db_hotel, $db_hotel);
$query_allhotels = sprintf("SELECT * FROM tb_hotel WHERE %s = 'colname' ORDER BY sterne DESC", $land_allhotels);
$allhotels = mysql_query($query_allhotels, $db_hotel) or die(mysql_error());
$row_allhotels = mysql_fetch_assoc($allhotels);
$totalRows_allhotels = mysql_num_rows($allhotels);
echo "Datei aufgerufen";
?>
Zweck: Im Formular wird das Land eingegeben in der form von d, a oder ch, und es werden nachher alle hotels im entsprechenden Land ausgegeben.
wenn ich die Abfrage in DW "teste" Doppelklick Datensatzgruppe ==> testen, funktioniert es einwandfrei.
Das Problem liegt wahrscheinlich da, dass ich nicht weiss wie das Formularfeld heissen soll, bzw. die Formularvariable. DW schreibt halt den Code ein bischen anders, als ich ihn gelernt habe, darum weiss ich es nicht... Vielleicht kann mir jemand helfen?
Wäre super, dankeschön
Gruss Belimo