if (isset($_POST['zurueck'])){
$_SESSION["kundendaten"]["email"] = $_POST["email"];
$_SESSION["kundendaten"]["anrede"] = $_POST["anrede"];
$a = ucwords($_POST["vorname"]);
$_SESSION["kundendaten"]["vorname"] = $a;
$a = ucwords($_POST["nachname"]);
$_SESSION["kundendaten"]["nachname"] = $a;
$a = ucwords($_POST["strasse"]);
$_SESSION["kundendaten"]["strasse"] = $a;
$_SESSION["kundendaten"]["plz"] = $_POST["plz"];
$a = ucwords($_POST["ort"]);
$_SESSION["kundendaten"]["ort"] = $a;
$_SESSION["kundendaten"]["land"] = $_POST["land"];
}
if ($_REQUEST['dbkunden'] &&
!empty($_REQUEST['email']) &&
!empty($_REQUEST['anrede']) &&
!empty($_REQUEST['vorname']) &&
!empty($_REQUEST['nachname']) &&
!empty($_REQUEST['strasse']) &&
!empty($_REQUEST['plz']) &&
!empty($_REQUEST['ort']) &&
!empty($_REQUEST['land'])
)
{
echo "Bitte überprüfen Sie Ihre Daten auf Richtigkeit<br>";
echo "<form action=\"$PHP_SELF\" method=\"post\" target=\"\">
<input type=\"hidden\" name=\"email\" value=\"".$_POST["email"]."\">
<input type=\"hidden\" name=\"anrede\" value=\"".$_POST["anrede"]."\">
<input type=\"hidden\" name=\"vorname\" value=\"".$_POST["vorname"]."\">
<input type=\"hidden\" name=\"nachname\" value=\"".$_POST["nachname"]."\">
<input type=\"hidden\" name=\"strasse\" value=\"".$_POST["strasse"]."\">
<input type=\"hidden\" name=\"plz\" value=\"".$_POST["plz"]."\">
<input type=\"hidden\" name=\"ort\" value=\"".$_POST["ort"]."\">
<input type=\"hidden\" name=\"land\" value=\"".$_POST["land"]."\">
<table border=\"1\" cellspacing=\"0\" cellpadding=\"3\">
<tr>
<td width=\"50\">email:
</td>
<td>".$_REQUEST['email']."
</td>
</tr>
<tr>
<td>Anrede:
</td>
<td>".$_REQUEST['anrede']."
</td>
</tr>
<tr>
<td>Name:
</td>
<td>".$_REQUEST['vorname']." ".$_REQUEST['nachname']."
</td>
</tr>
<tr>
<td>Straße:
</td>
<td>".$_REQUEST['strasse']."
</td>
</tr>
<tr>
<td>Plz / Ort
</td>
<td>".$_REQUEST['plz']." ".$_REQUEST['ort']."
</td>
</tr>
<tr>
<td>Land:
</td>
<td>".$_REQUEST['land']."
</td>
</tr>
<tr>
<td><input type=\"Submit\" name=\"senden\" value=\"Übertragen\">
</td>
<td><input type=\"Submit\" name=\"zurueck\" value=\"Zurück\">
</td>
</tr>
</table>";
}
elseif($_POST["senden"])
{
$kd_einfuegen = "INSERT INTO kunden(
email,
anrede,
vorname,
nachname,
strasse,
plz,
ort,
land
)
VALUES(
'$_POST[email]',
'$_POST[anrede]',
'$vorname',
'$nachname',
'$strasse',
'$_POST[plz]',
'$ort',
'$_POST[land]'
)";
$eintrag=mysql_query($kd_einfuegen);
echo mysql_error();
echo " Daten erfolgreich versendet";
}
else
{
echo "<form action=\"$PHP_SELF\" method=\"post\" target=\"\">
<table width=\"500\" border=\"0\" bgcolor=\"#DFDFDF\"
cellspacing=\"0\" cellpadding=\"3\">
<tr>
<td bgcolor=\"#EFEFEF\" colspan=\"2\" align=\"center\"><font
size=\"+3\">Kundendaten</font><br>
<font size=\"-1\">Bitte geben Sie Ihre persöhnlichen Daten ein</font>
</td>
</tr>";
$str = strlen($_SESSION['kundendaten']['email']);
if ($str > 0){
echo "
<tr>
<td width=\"25%\">E-Mail-Adresse:</td>
<td width=\"*%\"><input type=\"Text\" name=\"email\"
value=\"".$_SESSION['kundendaten']["email"]."\" size=\"50\"
maxlength=\"\"><br>
<font size=\"-1\">Bitte beachten Sie die korrekte Schreibweise Ihrer
E-Mail-Adresse</font></td>
</tr>";
}
else{
echo "
<tr>
<td width=\"25%\">E-Mail-Adresse:</td>
<td width=\"*%\"><input type=\"Text\" name=\"email\"
value=\"".$_POST["email"]."\" size=\"50\"
maxlength=\"\"><br>
<font size=\"-1\">Bitte beachten Sie die korrekte Schreibweise Ihrer
E-Mail-Adresse</font></td>
</tr>";
}
echo "
<tr>
<td width=\"25%\">Anrede:</td>
<td width=\"*%\">
<select name=\"anrede\">";
$arr_anreden = array('Herr', 'Frau', 'Firma', 'ohne');
foreach($arr_anreden as $str_anrede){
echo "<option value=\"".$str_anrede."\"";
if (isset($_POST['anrede']) and $_POST['anrede'] ==
$str_anrede){
echo "selected";
}
echo ">".$str_anrede."</option>";
}
echo "</select>
</td>
</tr>";
$str = strlen($_SESSION['kundendaten']['vorname']);
if ($str > 0){
echo "
<tr>
<td width=\"25%\">Vorname:</td>
<td width=\"*%\"><input type=\"Text\" name=\"vorname\"
value=\"".$_SESSION['kundendaten']["vorname"]."\" size=\"50\"
maxlength=\"\"></td>
</tr>";
}
else{
echo "
<tr>
<td width=\"25%\">Vorname:</td>
<td width=\"*%\"><input type=\"Text\" name=\"vorname\"
value=\"".$_POST["vorname"]."\" size=\"50\"
maxlength=\"\"></td>
</tr>";
}
$str = strlen($_SESSION['kundendaten']['nachname']);
if ($str > 0){
echo "
<tr>
<td width=\"25%\">Nachname:</td>
<td width=\"*%\"><input type=\"Text\" name=\"nachname\"
value=\"".$_SESSION['kundendaten']["nachname"]."\" size=\"50\"
maxlength=\"\"> </td>
</tr>";
}
else{
echo"
<tr>
<td width=\"25%\">Nachname:</td>
<td width=\"*%\"><input type=\"Text\" name=\"nachname\"
value=\"".$_POST["nachname"]."\" size=\"50\"
maxlength=\"\"> </td>
</tr>";
}
$str = strlen($_SESSION['kundendaten']['strasse']);
if ($str > 0){
echo"
<tr>
<td width=\"25%\">Straße/Nr:</td>
<td width=\"*%\"><input type=\"Text\" name=\"strasse\"
value=\"".$_SESSION['kundendaten']['strasse']."\" size=\"50\"
maxlength=\"\"></td>
</tr>";
}
else{
echo"
<tr>
<td width=\"25%\">Straße/Nr:</td>
<td width=\"*%\"><input type=\"Text\" name=\"strasse\"
value=\"".$_POST["strasse"]."\" size=\"50\"
maxlength=\"\"></td>
</tr>";
}
$str = strlen($_SESSION['kundendaten']['plz']);
if ($str > 0){
echo"
<tr>
<td width=\"25%\">PLZ:</td>
<td width=\"*%\"><input type=\"Text\" name=\"plz\"
value=\"".$_SESSION['kundendaten']["plz"]."\" size=\"50\"
maxlength=\"\"></td>
</tr>";
}
else{
echo"
<tr>
<td width=\"25%\">PLZ:</td>
<td width=\"*%\"><input type=\"Text\" name=\"plz\"
value=\"".$_POST['plz']."\" size=\"50\"
maxlength=\"\"></td>
</tr>";
}
$str = strlen($_SESSION['kundendaten']['ort']);
if ($str > 0){
echo"
<tr>
<td width=\"25%\">Ort:</td>
<td width=\"*%\"><input type=\"Text\" name=\"ort\"
value=\"".$_SESSION['kundendaten']['ort']."\" size=\"50\"
maxlength=\"\"></td>
</tr>";
}
else{
echo"
<tr>
<td width=\"25%\">Ort:</td>
<td width=\"*%\"><input type=\"Text\" name=\"ort\"
value=\"".$_POST["ort"]."\" size=\"50\"
maxlength=\"\"></td>
</tr>";
}
echo "
<tr>
<td width=\"25%\">Land:</td>
<td width=\"*%\">
<select name=\"land\" cellspacing=\"2\" cellpadding=\"2\">";
$arr_land = array('Deutschland', 'Österreich', 'Frankreich', 'Schweiz');
foreach($arr_land as $str_land){
echo '<option value="'.$str_land.'"';
if (isset($_POST['land']) and $_POST['land'] == $str_land)
{
echo 'selected';
}
echo '>'.$str_land.'</option>';
}
echo "</select>
</td>
</tr>
<tr>
<td>
<input type=\"submit\" name=\"dbkunden\" value=\"Daten Senden\">
</td>
</tr>
</table> </form>";
/* hier geht es zum Warenkorb zurück
************************************
*/
echo "<form action=\"warenkorb.php?id=".$_SESSION["id"]."&Seite=".$_SESSION["seite"]."\" name=\"senden\" method=\"POST\">
<input type=\"submit\" name=\"zurueck\" value=\"zurück\"></input>
</form>";
}