gruebel-gruebel
Erfahrenes Mitglied
Nicht erschrecken es ist viel
PHP:
<?php
session_start();
if(strlen($_POST["anrede"]) !=0) $_SESSION["str_anrede"] = $_POST["anrede"];
?>
<html>
<head>
<title></title>
</head>
<body>
<?php
echo "<div class=\"kd1\">";
if (isset($_POST['zurueck'])){
$_SESSION["kundendaten"]["email"] = $_POST["email"];
$_SESSION["kundendaten"]["anrede"] = $_SESSION["str_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=\"".$_SESSION["str_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=\"1px\" cellspacing=\"0\" cellpadding=\"5px\">
<tr>
<td width=\"50px\">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>";
}
if(isset($_POST['senden']))
{
$email_test = mysql_query("
SELECT
email,
kd_id
FROM
kunden
WHERE
email = '".$_POST['email']."'
");
while($email = mysql_fetch_assoc($email_test)){
$kunde_existiert = $email['kd_id'];
$lf_kd_id = $kunde_existiert;
}
if (mysql_num_rows($email_test) >=1){
$email_vorhanden = 1; // ja
}
else{
$email_vorhanden = 2; // nein
}
$senden1 = 1;
}
if ($email_vorhanden == 2 ){
$senden = 1;
$kd_einfuegen = "INSERT INTO kunden(
email,
anrede,
vorname,
nachname,
strasse,
plz,
ort,
land
)
VALUES(
'$_POST[email]',
'$_SESSION[str_anrede]',
'$vorname',
'$nachname',
'$strasse',
'$_POST[plz]',
'$ort',
'$_POST[land]'
)";
$eintrag=mysql_query($kd_einfuegen);
echo mysql_error();
$lf_kd_id = mysql_insert_id(); // Neuer Kunde letzte kd_id
// Hier wird die kd_id für den Lieferschein aus der Tabelle geholt.
}
if (isset($_POST['zurueck'])OR isset($_POST[tausch_absch]))
{
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 $anrede1){
echo "<option value=\"".$anrede1."\"";
if (isset($_SESSION["str_anrede"]) and $_SESSION["str_anrede"] == $anrede1){
echo " selected";
}
echo ">".$anrede1."</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 $land){
echo '<option value="'.$land.'"';
if (isset($_SESSION['str_land']) and $_SESSION['str_land'] == $land)
{
echo " selected";
}
echo '>'.$land.'</option>';
}
echo "</select>
</td>
</tr>
<tr>
<td>
<input type=\"submit\" name=\"dbkunden\" value=\"Daten Senden\">
</td>
<td>
</td>
</tr>
</table> </form>";
/* hier geht es zum Warenkorb zurück
************************************
*/
if (isset($_POST['zurueck_w'])){
$_SESSION["str_anrede"] = $_REQUEST["anrede"];}
echo "<div class=\"zurueck_warenkorb\">";
echo "<form action=\"warenkorb.php\" name=\"senden\" method=\"POST\">
<input type=\"submit\" name=\"zurueck_w\" value=\"zurück zum Warenkorb\"></input>
</form>";
echo "</div>";
/* hier geht es zum Bestellen zurück
************************************
*/
echo "<div class=\"zurueck_bestellen\">";
echo "<form action=\"index1.php?id=".$_SESSION["id"]."&Seite=".$_SESSION['Seite']."\" name=\"senden\" method=\"POST\">
<input type=\"submit\" name=\"zurueck_b\" value=\"zurück zum Bestellen\"></input>
</form>";
echo "</div>";
}
echo "</div>";