Servus, ich Versuche gerade meinem Kontaktformular einen Span Schutz hinzu zu fügen. Und zwar beim Anklicken des Buttons Abschicken soll geprüft werden ob alle sichtbaren Felder Ausgefüllt sind und das eine Feld dass nachher unsichtbar sein wird nicht ausgefüllt ist bevor alles abgeschickt wird. Leider scheint es so als bin ich gerade zu doof das Feld richtig aus lesen zu lassen. Denn der Befehl !empty sollte ja wissen welches Feld er prüfen soll ob es ausgefüllt ist.
Des Google Recapcha soll später noch weg.
DEr Code bislang schaut wie folgt aus:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<?php
if (isset($_POST["submit"]) && !empty($_POST['nichtausfüllen']))
mail("wcs@walterle.com", "Kontaktformular", 'Name: ' . $_POST["name"] . 'Vorname: ' . $_POST["vorname"] . ' Email: ' . $_POST["email"] . ' Hat dir eine Nachricht geschrieben: ' . $_POST["message"]);
?>
<div Class="row justify-content-center align-items-center anzeige">
<div class="col-xs-5 col-lg-8">
<h3 style="color: green;">Vielen Dank für Ihre Kontaktaufnahme</h3>
</div>
</div>
<?php
?>
<form class="row justify-content-center align-items-center kontaktformular" action="kontakt.html" method="post">
<div class="col-xs-5 col-lg-8">
<input class="row justify-content-center name" type="text" name="name" size="15" placeholder="Name*" required="required" autofocus></class><br>
<input class="row justify-content-center Vorname" type="text" name="vorname" size="15" placeholder="Vorname"></class><br>
<input class="row justify-content-center email" type="email" name="email" size="30" placeholder="Email*" required="required"></class><br>
<textarea class="row col-xs-5 col-lg-10 nachricht" name="message" Rowe="8" cols="60" placeholder="Nachricht*" required="required" outline="1px"></textarea></class><br>
<input class="row justify-content-center nichtausfüllen" type="text" name="nichtausfüllen"></class>
<button class="g-recaptcha button" name="submit" data-sitekey="6LeNXuwUAAAAAAvt5ebr4iet42Iz29JJ5ynuVj5s" data-callback='onSubmit'>Abschicken</button></class>
<script src="https://www.google.com/recaptcha/api.js?render=6LeNXuwUAAAAAEjFH-nNEnSCpdoIWdZVd70Dh6bU"></script>
<script>
grecaptcha.ready(function() {
grecaptcha.execute('6LeNXuwUAAAAAEjFH-nNEnSCpdoIWdZVd70Dh6bU', {
action: 'homepage'
}).then(function(token) {
});
});
</script>
</div>
</form>
</body>
</htm
Vielen Dank schonmal im vorraus.
Des Google Recapcha soll später noch weg.
DEr Code bislang schaut wie folgt aus:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<?php
if (isset($_POST["submit"]) && !empty($_POST['nichtausfüllen']))
mail("wcs@walterle.com", "Kontaktformular", 'Name: ' . $_POST["name"] . 'Vorname: ' . $_POST["vorname"] . ' Email: ' . $_POST["email"] . ' Hat dir eine Nachricht geschrieben: ' . $_POST["message"]);
?>
<div Class="row justify-content-center align-items-center anzeige">
<div class="col-xs-5 col-lg-8">
<h3 style="color: green;">Vielen Dank für Ihre Kontaktaufnahme</h3>
</div>
</div>
<?php
?>
<form class="row justify-content-center align-items-center kontaktformular" action="kontakt.html" method="post">
<div class="col-xs-5 col-lg-8">
<input class="row justify-content-center name" type="text" name="name" size="15" placeholder="Name*" required="required" autofocus></class><br>
<input class="row justify-content-center Vorname" type="text" name="vorname" size="15" placeholder="Vorname"></class><br>
<input class="row justify-content-center email" type="email" name="email" size="30" placeholder="Email*" required="required"></class><br>
<textarea class="row col-xs-5 col-lg-10 nachricht" name="message" Rowe="8" cols="60" placeholder="Nachricht*" required="required" outline="1px"></textarea></class><br>
<input class="row justify-content-center nichtausfüllen" type="text" name="nichtausfüllen"></class>
<button class="g-recaptcha button" name="submit" data-sitekey="6LeNXuwUAAAAAAvt5ebr4iet42Iz29JJ5ynuVj5s" data-callback='onSubmit'>Abschicken</button></class>
<script src="https://www.google.com/recaptcha/api.js?render=6LeNXuwUAAAAAEjFH-nNEnSCpdoIWdZVd70Dh6bU"></script>
<script>
grecaptcha.ready(function() {
grecaptcha.execute('6LeNXuwUAAAAAEjFH-nNEnSCpdoIWdZVd70Dh6bU', {
action: 'homepage'
}).then(function(token) {
});
});
</script>
</div>
</form>
</body>
</htm
Vielen Dank schonmal im vorraus.
Kommentar