PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
>Kontaktformular
Beitrag
<blockquote data-quote="owieortho" data-source="post: 2772952" data-attributes="member: 443210"><p>Ich habe die Fehlerstellen markiert, die erst einmal korrigiert werden sollten bevor die nächste Funktionsprüfung stattfindet.</p><p><?php</p><p></p><p> error_reporting(-1);</p><p></p><p> ini_set('display_errors', 'On');</p><p></p><p> /**</p><p></p><p> * Eingabe</p><p></p><p> */</p><p></p><p> $options = [</p><p></p><p> 'allgemeine_anfrage'=>['title'=>'Allgemeine Anfrage','selected'=>false],</p><p></p><p> 'technische_anfrage'=>['title'=>'Technische Anfrage', 'selected'=>false],</p><p></p><p> 'sonstige_anfrage'=>['title' =>'Sonstige Anfrage', 'selected'=>false],</p><p></p><p> ];</p><p></p><p> $name='';</p><p></p><p> $lastname='';</p><p></p><p> $email ='';</p><p></p><p> $betreff='';</p><p></p><p> $message='';</p><p></p><p> $isPostRequest = $_SERVER['REQUEST_METHOD'] === 'POST';</p><p></p><p> $errors =[];</p><p></p><p> //Verarbeitung</p><p></p><p> //</p><p></p><p> if($isPostRequest) {</p><p></p><p> $name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING);</p><p></p><p> $lastname = filter_input(INPUT_POST, '<strong><span style="color: rgb(255, 0, 0)">message</span></strong>', FILTER_SANITIZE_STRING);</p><p></p><p> $email = filter_input(INPUT_POST, '<span style="color: rgb(255, 0, 0)"><strong>message</strong></span>', FILTER_SANITIZE_STRING);</p><p></p><p> $message = filter_input(INPUT_POST, 'message', FILTER_SANITIZE_STRING);</p><p></p><p> $subject = filter_input(INPUT_POST, 'subject', FILTER_SANITIZE_STRING);</p><p></p><p></p><p> if (isset($options[$subject])) {</p><p></p><p> $options[$subject]['selected'] = true;</p><p></p><p> }</p><p></p><p> if (!$name) {</p><p></p><p> $errors[] = 'Vorname ist leer';</p><p></p><p> }</p><p></p><p> if (!$lastname) {</p><p></p><p> $errors[] = 'Nachname ist leer';</p><p></p><p> }</p><p></p><p> if (!$email) {</p><p></p><p> $errors[] = 'Email ist leer';</p><p></p><p> }</p><p></p><p> if (!$message) {</p><p></p><p> $errors[] = 'Bitte eine Nachricht hinterlassen';</p><p></p><p> }</p><p></p><p> if (!isset($options[$subject])) {</p><p></p><p> $errors[] = 'Bitte<span style="color: rgb(255, 0, 0)"><strong> b</strong></span>etreff auswählen';</p><p></p><p> }</p><p></p><p> $data = [</p><p></p><p> 'name' => $name,</p><p></p><p> 'lastname' =>$lastname,</p><p></p><p> 'email' =>$email,</p><p></p><p> 'subject'=>$options[$subject]['title'],</p><p></p><p> 'message'=>$message</p><p></p><p> ];</p><p></p><p> file_put_contents('datei.txt', serialize($data) . ';;;', FILE_APPEND);</p><p></p><p></p><p> $_POST = [];</p><p></p><p> $options[$subject]['selected'] = false;</p><p></p><p> $subject = null;</p><p></p><p> $name = '';</p><p></p><p> $lastname = '';</p><p></p><p> $email = '';</p><p></p><p> $message = '';</p><p></p><p></p><p> }</p><p></p><p></p><p> ?></p><p></p><p></p><p> <!DOCTYPE html></p><p></p><p> <html lang="de"></p><p></p><p> <head></p><p></p><p> <meta charset="UTF-8"></p><p></p><p> <meta http-equiv="X-UA-Compatible" content="IE-edge"></p><p></p><p> <meta name="viewport" content="width-device-with, initial-scale=1.0"></p><p></p><p> <link rel="stylesheet" href="styles.css"></p><p></p><p> <title>Kontaktformular</title></p><p></p><p> <meta charset="UTF-8"></p><p></p><p> </head></p><p></p><p> <body></p><p></p><p> <?php if($isPostRequest):?></p><p></p><p> <section class="container" id="<span style="color: rgb(255, 0, 0)"><strong>alets</strong></span>"></p><p></p><p> <?php if(count($errors) === 0):?></p><p></p><p> <div class="alert alert-success" role="alert"></p><p></p><p> Anfrage versendet!</p><p></p><p> <button type="button" class="close" data-dismiss="alert" aria-label="Close"></p><p></p><p> <span aria-hidden="true">&times;</span></p><p></p><p> </button></p><p></p><p> </div></p><p></p><p> <?php endif;?></p><p></p><p> <?php if(count($errors) > 0):?></p><p></p><p> <div class="alert alert-danger" role="alert"></p><p></p><p> Fehler beim <span style="color: rgb(255, 0, 0)"><strong>v</strong></span>ersenden der Anfrage</p><p></p><p> <button type="button" class="close" data-dismiss="alert" aria-label="Close"></p><p></p><p> <span aria-hidden="true">&times;</span></p><p></p><p> </button></p><p></p><p> <?php foreach($errors as $errorMessage):?></p><p></p><p> <p><?= $errorMessage ?></p></p><p></p><p> <?php endforeach;?></p><p></p><p> </div></p><p></p><p> <?php endif;?></p><p></p><p> </section></p><p></p><p> <?php endif;?></p><p></p><p> <div></p><p></p><p> <?php</p><p></p><p> if (isset($_POST['submit'])) {</p><p></p><p> mail("<a href="mailto:kcb@schickma.de">kcb@schickma.de</a>", "Kontaktformular", 'Name: ' . $_POST["name"] . 'Nachname: ' . $_POST["<span style="color: rgb(255, 0, 0)"><strong>lasname</strong></span>"] . 'Email: ' . $_POST["email"] . 'Nachricht: ' . $_POST["message"]);</p><p></p><p> }</p><p></p><p> ?></p><p></p><p> </div></p><p></p><p> <div class="formcross"></p><p></p><p> <img class="somethingStrange" src="./img/vector-1.png" alt=""></p><p></p><p> <img class="roundspin" src="./img/vector-2.png" alt=""></p><p></p><p> <div class="formBox"></p><p></p><p> <img class="roboCop" src="./img/Logo_Robikopf_Klein.png" alt=""></p><p></p><p> <form action="./index.php" method="post" target="ausgabe"></p><p></p><p> <div class="headingBox"></p><p></p><p> <h1>Wie können wir dir helfen?</h1></p><p></p><p> </div></p><p></p><p> <fieldset class="formColHalf"></p><p></p><p> <input required type="text" value="<?= htmlspecialchars($name, ENT_QUOTES, 'UTF-8') ?>" id="<span style="color: rgb(255, 0, 0)"><strong>N</strong></span>ame" name="Name" placeholder="Vorrname*" maxlength="50" ></p><p></p><p> <input required type="text" value="<?= htmlspecialchars($lastname, ENT_QUOTES, 'UTF-8') ?>" id="<strong><span style="color: rgb(255, 0, 0)">L</span></strong>astname" name="Lastname" placeholder="Nachname*" maxlength="50" ></p><p></p><p> <input required type="email" value="<?= htmlspecialchars($email, ENT_QUOTES, 'UTF-8') ?>" id="Email" name="<strong><span style="color: rgb(255, 0, 0)">E</span></strong>mail" placeholder="Email*" maxlength="50" ></p><p></p><p> <input type="tel" placeholder="Telefon"> <strong><span style="color: rgb(255, 0, 0)">Wird das verarbeitet? name? id?</span></strong></p><p></p><p> </fieldset></p><p></p><p> <fieldset></p><p></p><p> <select name="<strong><span style="color: rgb(255, 0, 0)">B</span></strong>etreff"></p><p></p><p> <option>Bitte Wählen</option></p><p></p><p> <?php foreach($options as $value => $item):</p><p></p><p> $selectString = $item['selected']?' selected':'';</p><p></p><p> ?></p><p></p><p> <option value="<?= $value?>"<?=$selectString?>><?= $item['title']?></option></p><p></p><p> <?php endforeach;?></p><p></p><p> </select></p><p></p><p> <textarea id="message" name="Nachricht" rows="5" cols="80" required <?= htmlspecialchars($message, ENT_QUOTES, 'UTF-8') ?> maxlength="250"></textarea></p><p></p><p> <div></div></p><p></p><p> <button type="submit" name="submit">Absenden</button></p><p></p><p> </fieldset></p><p></p><p> </form></p><p></p><p> </div></p><p></p><p> </div></p><p></p><p> </body></p><p></p><p> </html></p><p></p><p>Viel Erfolg</p><p>O.</p></blockquote><p></p>
[QUOTE="owieortho, post: 2772952, member: 443210"] Ich habe die Fehlerstellen markiert, die erst einmal korrigiert werden sollten bevor die nächste Funktionsprüfung stattfindet. <?php error_reporting(-1); ini_set('display_errors', 'On'); /** * Eingabe */ $options = [ 'allgemeine_anfrage'=>['title'=>'Allgemeine Anfrage','selected'=>false], 'technische_anfrage'=>['title'=>'Technische Anfrage', 'selected'=>false], 'sonstige_anfrage'=>['title' =>'Sonstige Anfrage', 'selected'=>false], ]; $name=''; $lastname=''; $email =''; $betreff=''; $message=''; $isPostRequest = $_SERVER['REQUEST_METHOD'] === 'POST'; $errors =[]; //Verarbeitung // if($isPostRequest) { $name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING); $lastname = filter_input(INPUT_POST, '[B][COLOR=rgb(255, 0, 0)]message[/COLOR][/B]', FILTER_SANITIZE_STRING); $email = filter_input(INPUT_POST, '[COLOR=rgb(255, 0, 0)][B]message[/B][/COLOR]', FILTER_SANITIZE_STRING); $message = filter_input(INPUT_POST, 'message', FILTER_SANITIZE_STRING); $subject = filter_input(INPUT_POST, 'subject', FILTER_SANITIZE_STRING); if (isset($options[$subject])) { $options[$subject]['selected'] = true; } if (!$name) { $errors[] = 'Vorname ist leer'; } if (!$lastname) { $errors[] = 'Nachname ist leer'; } if (!$email) { $errors[] = 'Email ist leer'; } if (!$message) { $errors[] = 'Bitte eine Nachricht hinterlassen'; } if (!isset($options[$subject])) { $errors[] = 'Bitte[COLOR=rgb(255, 0, 0)][B] b[/B][/COLOR]etreff auswählen'; } $data = [ 'name' => $name, 'lastname' =>$lastname, 'email' =>$email, 'subject'=>$options[$subject]['title'], 'message'=>$message ]; file_put_contents('datei.txt', serialize($data) . ';;;', FILE_APPEND); $_POST = []; $options[$subject]['selected'] = false; $subject = null; $name = ''; $lastname = ''; $email = ''; $message = ''; } ?> <!DOCTYPE html> <html lang="de"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE-edge"> <meta name="viewport" content="width-device-with, initial-scale=1.0"> <link rel="stylesheet" href="styles.css"> <title>Kontaktformular</title> <meta charset="UTF-8"> </head> <body> <?php if($isPostRequest):?> <section class="container" id="[COLOR=rgb(255, 0, 0)][B]alets[/B][/COLOR]"> <?php if(count($errors) === 0):?> <div class="alert alert-success" role="alert"> Anfrage versendet! <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <?php endif;?> <?php if(count($errors) > 0):?> <div class="alert alert-danger" role="alert"> Fehler beim [COLOR=rgb(255, 0, 0)][B]v[/B][/COLOR]ersenden der Anfrage <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span> </button> <?php foreach($errors as $errorMessage):?> <p><?= $errorMessage ?></p> <?php endforeach;?> </div> <?php endif;?> </section> <?php endif;?> <div> <?php if (isset($_POST['submit'])) { mail("[EMAIL]kcb@schickma.de[/EMAIL]", "Kontaktformular", 'Name: ' . $_POST["name"] . 'Nachname: ' . $_POST["[COLOR=rgb(255, 0, 0)][B]lasname[/B][/COLOR]"] . 'Email: ' . $_POST["email"] . 'Nachricht: ' . $_POST["message"]); } ?> </div> <div class="formcross"> <img class="somethingStrange" src="./img/vector-1.png" alt=""> <img class="roundspin" src="./img/vector-2.png" alt=""> <div class="formBox"> <img class="roboCop" src="./img/Logo_Robikopf_Klein.png" alt=""> <form action="./index.php" method="post" target="ausgabe"> <div class="headingBox"> <h1>Wie können wir dir helfen?</h1> </div> <fieldset class="formColHalf"> <input required type="text" value="<?= htmlspecialchars($name, ENT_QUOTES, 'UTF-8') ?>" id="[COLOR=rgb(255, 0, 0)][B]N[/B][/COLOR]ame" name="Name" placeholder="Vorrname*" maxlength="50" > <input required type="text" value="<?= htmlspecialchars($lastname, ENT_QUOTES, 'UTF-8') ?>" id="[B][COLOR=rgb(255, 0, 0)]L[/COLOR][/B]astname" name="Lastname" placeholder="Nachname*" maxlength="50" > <input required type="email" value="<?= htmlspecialchars($email, ENT_QUOTES, 'UTF-8') ?>" id="Email" name="[B][COLOR=rgb(255, 0, 0)]E[/COLOR][/B]mail" placeholder="Email*" maxlength="50" > <input type="tel" placeholder="Telefon"> [B][COLOR=rgb(255, 0, 0)]Wird das verarbeitet? name? id?[/COLOR][/B] </fieldset> <fieldset> <select name="[B][COLOR=rgb(255, 0, 0)]B[/COLOR][/B]etreff"> <option>Bitte Wählen</option> <?php foreach($options as $value => $item): $selectString = $item['selected']?' selected':''; ?> <option value="<?= $value?>"<?=$selectString?>><?= $item['title']?></option> <?php endforeach;?> </select> <textarea id="message" name="Nachricht" rows="5" cols="80" required <?= htmlspecialchars($message, ENT_QUOTES, 'UTF-8') ?> maxlength="250"></textarea> <div></div> <button type="submit" name="submit">Absenden</button> </fieldset> </form> </div> </div> </body> </html> Viel Erfolg O. [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ★ = 12, ◇ = 4 und die Hälfte von ★ zu ◇ addiert wird, was ist das Ergebnis?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
>Kontaktformular
Oben