<?php
$sql = "SELECT *, DATE_FORMAT(Datum, '%d.%m.%Y') AS Datum, DATE_FORMAT(Geb_Datum, '%d.%m.%Y') AS Geb_Datum FROM " . PREFIX . "_Kontakte WHERE ID = \"" . $_POST['ID'] . "\";";
$result = $db->query($sql);
$nt = $result->fetch_assoc();

echo "<form action=\"index.php?" . $_SERVER['QUERY_STRING'] . "\" method=\"post\" />\n";
echo "	<fieldset>\n";
echo "		<legend>Kunde bearbeiten</legend>\n";
echo "		<input type=\"hidden\" name=\"edit\" value=\"edit\" />\n";
echo "		<input type=\"hidden\" name=\"ID\" value=\"" . $nt['ID'] . "\" />\n";
echo "		<b>\n";
echo "		<h2>Kundendaten</h2>\n";
echo "		<label>Kundennummer</label>\n";
echo "		<label class=\"data\">" . $nt['ID'] . "</label>\n";
echo "		<br />\n";
echo "		<label>Kunde seit</label>\n";
echo "		<label class=\"data\">" . $nt['Datum'] . "</label>\n";
echo "		</b>\n";
echo "		<br />&nbsp;<br />\n";
echo "		<label>Firma</label>\n";
echo "		<input type=\"text\" name=\"Firma\" value=\"" . $nt['Firma'] . "\" />\n";
echo "		<br />\n";
echo "		<label>Anrede</label>\n";
echo "		<select name=\"Anrede\">\n";
echo "			<option value=\"Herr\"";
if ("Herr" == $nt['Anrede'])
{
	echo " selected=\"selected\"";
}
echo ">Herr</option>\n";
echo "			<option value=\"Frau\"";
if ("Frau" == $nt['Anrede'])
{
	echo " selected=\"selected\"";
}
echo ">Frau</option>\n";
echo "		</select>\n";
echo "		<br />\n";
echo "		<label>Vorname</label>\n";
echo "		<input type=\"text\" name=\"Vorname\"  value=\"" . $nt['Vorname'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>Nachname</label>\n";
echo "		<input type=\"text\" name=\"Nachname\"  value=\"" . $nt['Nachname'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>Strasse</label>\n";
echo "		<input type=\"text\" name=\"Strasse\"  value=\"" . $nt['Strasse'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>Hausnummer</label>\n";
echo "		<input type=\"text\" name=\"Nummer\"  value=\"" . $nt['Nummer'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>PLZ</label>\n";
echo "		<input type=\"text\" name=\"PLZ\"  value=\"" . $nt['PLZ'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>Ort</label>\n";
echo "		<input type=\"text\" name=\"Ort\"  value=\"" . $nt['Ort'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>Land</label>\n";
echo "		<input type=\"text\" name=\"Land\"  value=\"" . $nt['Land'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>Geburtsdatum</label>\n";
echo "		<input type=\"text\" name=\"Geb_Datum\"  value=\"" . $nt['Geb_Datum'] . "\"/>\n";
echo "		<img src=\"img/small_info.png\" alt=\"Datum der Form: <TT.MM.JJJJ>\" title=\"Datum der Form: <TT.MM.JJJJ>\" />\n";
echo "		<br />\n";
echo "		<label>Telefon</label>\n";
echo "		<input type=\"text\" name=\"Telefon\"  value=\"" . $nt['Telefon'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>Fax</label>\n";
echo "		<input type=\"text\" name=\"Fax\"  value=\"" . $nt['Fax'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>Mobil</label>\n";
echo "		<input type=\"text\" name=\"Mobil\"  value=\"" . $nt['Mobil'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>Email</label>\n";
echo "		<input type=\"text\" name=\"Email\"  value=\"" . $nt['Email'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>Homepage</label>\n";
echo "		<input type=\"text\" name=\"Homepage\"  value=\"" . $nt['Homepage'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>Registergericht</label>\n";
echo "		<input type=\"text\" name=\"Gericht\"  value=\"" . $nt['Gericht'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>USt-ID / SteuerNr.</label>\n";
echo "		<input type=\"text\" name=\"SteuerNr\"  value=\"" . $nt['SteuerNr'] . "\"/>\n";
echo "		<br />\n";
echo "		<h2>Bankverbindung</h2>\n";
echo "		<label>Inhaber</label>\n";
echo "		<input type=\"text\" name=\"Kto_Inhaber\"  value=\"" . $nt['Kto_Inhaber'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>IBAN</label>\n";
echo "		<input type=\"text\" name=\"Kto_Nummer\"  value=\"" . $nt['Kto_Nummer'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>BIC</label>\n";
echo "		<input type=\"text\" name=\"BLZ\"  value=\"" . $nt['BLZ'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>Bank</label>\n";
echo "		<input type=\"text\" name=\"Bank\"  value=\"" . $nt['Bank'] . "\"/>\n";
echo "		<br />\n";
echo "		<label>Datenschutzerklärung</label>\n";
echo "		<input type=\"checkbox\" name=\"DSchutz\"  value=\"1\" ";
if ($nt['DSchutz'])
{
	echo "checked=\"checked\" ";
}
echo "/>\n";
echo "		<br />\n";
echo "	</fieldset>\n";
echo "	<fieldset>\n";
echo "		<legend>Kunde speichern</legend>\n";
echo "		<input type=\"submit\" class=\"button_save\" name=\"formaction\" value=\"save\" title=\"Kunde speichern\" />\n";
echo "		<br />\n";
echo "	</fieldset>\n";
echo "</form>\n";