<?php
if (isset($_POST['Anzeigen']))
{
$suche = $_POST['kundennr'];
echo "<br><br>";
echo "Gesuchte Kundennummer: ".$suche."<br>";
echo "<br>";
$abfrage = "SELECT * FROM buchung WHERE kundennr LIKE '$suche'";
$ergebnis = mysql_query($abfrage);
echo "<form action='aendern.php' method='POST'>";
while($row = mysql_fetch_object($ergebnis))
{
echo "<input type='Text' name='name' value='$row->Name' size='' maxlength=''><br>";
echo "<input type='Text' name='vorname' value='$row->Vorname' size='' maxlength=''><br>";
echo "<input type='Text' name='strasse' value='$row->Strasse' size='' maxlength=''><br>";
echo "<input type='Text' name='hausnr' value='$row->Hausnr' size='' maxlength=''><br>";
echo "<input type='Text' name='plz' value='$row->Plz' size='' maxlength=''><br>";
echo "<input type='Text' name='ort' value='$row->Ort' size='' maxlength=''><br>";
echo "<input type='Text' name='telefonnr' value='$row->Telefonnr' size='' maxlength=''><br>";
echo "<input type='Text' name='zimmernr' value='$row->Zimmernr' size='' maxlength=''><br>";
echo "<input type='Text' name='zimmerart' value='$row->Zimmerart' size='' maxlength=''><br>";
echo "<input type='Text' name='buchungsnr' value='$row->Buchungsnr' size='' maxlength=''><br>";
echo "<input type='Text' name='ankunft' value='$row->Ankunft' size='' maxlength=''><br>";
echo "<input type='Text' name='abfahrt' value='$row->Abfahrt' size='' maxlength=''><br>";
echo "<input type='Text' name='kundennr' value='$row->Kundennr' size='' maxlength='' readonly>";
echo "<br>";
}
echo"<input type='Submit' name='Speichern' value='Speichern'>";
echo "</form>";
}
if (isset($_POST['Speichern']))
{
$table = 'buchung';
$table1 ='zimmer';
$aendern = "UPDATE $table SET Name ='$name',Vorname ='$vorname',Strasse ='$strasse',Hausnr ='$hausnr',Plz ='$plz' ,Ort ='$ort',Telefonnr ='$telefonnr',Zimmernr ='$zimmernr',Zimmerart='$zimmerart', Buchungsnr='$buchungsnr',Ankunft ='$ankunft',Abfahrt ='$abfahrt',Kundenr ='$kundennr' WHERE kundennr = '$kundennr'";
$result = mysql_db_query ($db, $aendern) or die (mysql_error());
}