Compare commits

2 Commits

141
index.php
View File

@@ -74,8 +74,8 @@
* Mail-Kram * Mail-Kram
*/ */
$mail_to = "jandop@yahoo.de"; //$mail_to = "jandop@yahoo.de";
//$mail_to = "sockenklaus@gmail.com"; $mail_to = "sockenklaus@gmail.com";
$subject = "Rundkopfschlitzschrauben - Bestellformular"; $subject = "Rundkopfschlitzschrauben - Bestellformular";
/* /*
@@ -177,7 +177,7 @@
$headers .= "MIME-Version: 1.0\r\n"; $headers .= "MIME-Version: 1.0\r\n";
$headers .= "\r\n"; $headers .= "\r\n";
$mail_ok = mail($mail_to, $subject, $text, $headers); //$mail_ok = mail($mail_to, $subject, $text, $headers);
if ($mail_ok) { if ($mail_ok) {
$form_errors[] = "Mail erfolgreich verschickt."; $form_errors[] = "Mail erfolgreich verschickt.";
@@ -198,14 +198,20 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>DIN 86 Metrisch Rundkopf-Schlitzschrauben</title> <title>DIN 86 Metrisch Rundkopf-Schlitzschrauben</title>
<link rel="stylesheet" type="text/css" href="css/style.css" /> <!--<link rel="stylesheet" type="text/css" href="css/style.css" />-->
<script type="text/javascript" src="js/form_helper.js" defer></script> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<!--<script type="text/javascript" src="js/form_helper.js" defer></script>-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</head> </head>
<pre>
<body> <?php
<div class="container"> var_dump($_POST)
<div> ?>
<a href="/"><h1>DIN 86 Metrisch Rundkopf-Schlitzschrauben</h1></a> </pre>
<body class="bg-secondary">
<div class="container bg-white px-5 py-4">
<div class="mx-auto">
<a href="/" class="link-dark"><h1>DIN 86 Metrisch Rundkopf-Schlitzschrauben</h1></a>
<table> <table>
<tr><td colspan="2" style="font-weight: bold;">Preise:</td></tr> <tr><td colspan="2" style="font-weight: bold;">Preise:</td></tr>
@@ -253,17 +259,12 @@
</div> </div>
<form action="index.php#form" method="post"> <form action="index.php#form" method="post">
<table class="table table-sm align-middle">
<?php <?php
foreach ($array as $key => $values) { foreach ($array as $key => $values) {
echo ' echo '
<table class="schrauben" rules="all">
<colgroup>
<col width="*" />
<col width="*" />
<col width="70px" />
</colgroup>
<tr> <tr>
<th>Schrauben in '.$key.' Größe</th> <th>Schrauben in '.$key.' Größe</th>
<th>Ausführung</th> <th>Ausführung</th>
@@ -276,11 +277,12 @@
$has_error = array_key_exists($key, $screw_errors); $has_error = array_key_exists($key, $screw_errors);
echo '<tr> echo '<tr>
<td>'. $value[0].'</td> <td>'. $value[0] .'</td>
<td>'.$value[1].'</td> <td>'. $value[1] .'</td>
<td> <td>
<input <input
type="text" type="text"
class="form-control"
size="4" size="4"
maxlength="4" maxlength="4"
name="schrauben['.$key.']" name="schrauben['.$key.']"
@@ -293,21 +295,26 @@
if($has_error) { if($has_error) {
echo ' echo '
<tr> <tr>
<td colspan="3" class="error"> <td colspan="3" class="text-end text-danger">
<span style="color:red">'. $screw_errors[$key] .'</span> '. $screw_errors[$key] .'
</td> </td>
</tr> </tr>
'; ';
} }
} }
echo ' echo '
</table> <tr>
<td colspan="3" class="border-bottom-0">&nbsp</td>
</tr>
'; ';
} }
if(count($form_errors) == 0 && count($screw_errors) == 0) echo '<br />'; echo '
</table>
';
//if(count($form_errors) == 0 && count($screw_errors) == 0) echo '<br />';
?> ?>
<p class="error"> <p class="text-danger text-center">
<?php <?php
if(count($screw_errors) > 0) echo 'Fehler bei der Schraubenauswahl. Bitte prüfen.<br />'; if(count($screw_errors) > 0) echo 'Fehler bei der Schraubenauswahl. Bitte prüfen.<br />';
foreach($form_errors as $error) { foreach($form_errors as $error) {
@@ -315,39 +322,65 @@
} }
?> ?>
</p> </p>
<div class="grid-container"> <h2>Bestellformular</h2>
<label for="name">Name / Vorname: *</label> <div>
<input type="text" name="name" id="name" value="<?=$name;?>" required /> <div class="row mb-3">
<div class="form_feedback">Name / Vorname erforderlich.</div> <label class="col-sm col-form-label" for="name">Name / Vorname: *</label>
<div class="col-sm">
<label for="strasse">Straße, Hausnummer: *</label> <input type="text" class="form-control" id="name" name="name" value="<?=$name;?>" required />
<input type="text" name="strasse" id="strasse" value="<?=$strasse;?>" required /> </div>
<div class="form_feedback">Straße und Hausnummer erforderlich.</div> </div>
<div class="row mb-3">
<label for="plz">PLZ: *</label> <label class="col-sm col-form-label" for="strasse">Straße, Hausnummer: *</label>
<input type="text" name="plz" id="plz" value="<?=$plz;?>" required /> <div class="col-sm">
<div class="form_feedback">Postleitzahl erforderlich.</div> <input type="text" class="form-control" id="strasse" name="strasse" value="<?=$strasse;?>" required />
</div>
<label for="stadt">Stadt: *</label> </div>
<input type="text" name="stadt" id="stadt" value="<?=$stadt?>" required /> <div class="row mb-3">
<div class="form_feedback">Stadt erforderlich.</div> <label class="col-sm col-form-label" for="plz">PLZ: *</label>
<div class="col-sm">
<label for="email">Email: *</label> <input type="text" class="form-control" id="plz" name="plz" value="<?=$plz;?>" required />
<input type="email" name="email" id="email" value="<?=$mail_from;?>" required /> </div>
<div class="form_feedback">(Korrekte) E-Mail-Adresse erforderlich.</div> </div>
<div class="row mb-3">
<label for="telefon">Telefon:</label> <label class="col-sm col-form-label" for="stadt">Stadt: *</label>
<input type="tel" name="telefon" id="telefon" value="<?=$telefon;?>" /> <div class="col-sm">
<div class="form_feedback">Bitte Telefonnummer eingeben.</div> <input type="text" class="form-control" id="stadt" name="stadt" value="<?=$stadt?>" required />
</div>
</div>
<div class="row mb-3">
<label class="col-sm col-form-label" for="email">Email: *</label>
<div class="col-sm">
<input type="email" class="form-control" id="email" name="email" value="<?=$mail_from;?>" required />
</div>
</div>
<div class="row mb-3">
<label class="col-sm col-form-label" for="telefon">Telefon:</label>
<div class="col-sm">
<input type="tel" class="form-control" id="telefon" name="telefon" value="<?=$telefon;?>" />
</div>
</div>
<div class="row mb-3">
<label class="col-sm col-form-label" for="notiz">Notiz:</label>
<div class="col-sm">
<textarea class="col-sm form-control" rows="4" id="notiz" name="notiz"><?=$notiz;?></textarea>
</div>
</div>
<div class="row mb-3">
<div class="col-sm">
Mit Sternchen markierte Felder müssen ausgefüllt sein.
</div>
</div>
<div class="row-2 mb-3">
<div class="col-sm">
<input class="btn btn-primary" type="submit" name="senden" value="Abschicken" />
</div>
</div>
</div> </div>
<p>Notiz:</p>
<textarea name="notiz"><?=$notiz;?></textarea>
<p>Mit Sternchen markierte Felder müssen ausgefüllt sein.</p>
<input type="submit" name="senden" value="Abschicken" />
</form> </form>
<div> <div class="mt-5">
<h2>Impressum</h2> <h2>Impressum</h2>
Jan Dopheide<br /> Jan Dopheide<br />
Schulstr. 40 b<br /> Schulstr. 40 b<br />