Hallo habe gerade mein Kontaktformular in betrieb genommen und muss feststellen, dass es hoffnungslos veraltet ist (php 5,2)
Oder ich aus Ahnungslosigkeit falsch konfiguriert habe
Vielleicht hat jemand ein passendes PHP, das ich einfach über mein HTML und CSS legen kann.
HTML
<!-- CONTACT -->
<section id="contact" data-stellar-background-ratio="0.5">
<div class="container">
<div class="row">
<!-- How to change your own map point
1. Go to Google Maps
2. Click on your location point
3. Click "Share" and choose "Embed map" tab
4. Copy only URL and paste it within the src="" field below
-->
<div class="wow fadeInUp col-md-6 col-sm-12" data-wow-delay="0.4s">
<div id="google-map">
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d8749.512149352304!2d8.825911783328033!3d49.84152280001934!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x47bd662419aa87f5%3A0x3f837774e41ef390!2sRistorante%20Sicilia!5e0!3m2!1sde!2sde!4v1696165419991!5m2!1sde!2sde" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"allowfullscreen></iframe>
</div>
</div>
<div class="col-md-6 col-sm-12">
<div class="col-md-12 col-sm-12">
<div class="section-title wow fadeInUp" data-wow-delay="0.1s">
<h2>Kontakt</h2>
</div>
</div>
<!-- CONTACT FORM -->
<form action="#" method="post" class="wow fadeInUp" id="contact-form" role="form" data-wow-delay="0.8s">
<!-- IF MAIL SENT SUCCESSFUL // connect this with custom JS -->
<h6 class="text-success">Your message has been sent successfully.</h6>
<!-- IF MAIL NOT SENT -->
<h6 class="text-danger">E-mail must be valid and message must be longer than 1 character.</h6>
<div class="col-md-6 col-sm-6">
<input type="text" class="form-control" id="cf-name" name="name" placeholder="Name">
</div>
<div class="col-md-6 col-sm-6">
<input type="email" class="form-control" id="cf-email" name="email" placeholder="Email Adresse">
</div>
<div class="col-md-12 col-sm-12">
<input type="text" class="form-control" id="cf-subject" name="subject" placeholder="Betreff">
<textarea class="form-control" rows="6" id="cf-message" name="message" placeholder="Ihre Nachricht"></textarea>
<button type="submit" class="form-control" id="cf-submit" name="submit">Senden</button>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
Alles anzeigen
CSS
#contact .section-title {
padding-bottom: 0;
}
#contact{
background-color: #a79c9c;
}
#contact .text-success,
#contact .text-danger {
display: none;
}
#contact .form-control {
background:white;
border: 0;
border-bottom: 1px solid #dddddd;
border-radius: 0;
box-shadow: none;
font-size: 14px;
font-weight: normal;
margin-bottom: 15px;
transition: all ease-in-out 0.4s;
}
#contact .form-control:hover,
#contact .form-control:focus {
border-bottom-color: #c9c9c9;
}
#contact input {
height: 55px;
}
#contact button#cf-submit {
background: #ce3232;
border-radius: 0;
border: 0;
color: #ffffff;
font-weight: bold;
height: 50px;
}
#contact button#cf-submit:hover {
background: #292929;
color: #ffffff;
}
Alles anzeigen
PHP
<?php
// Email Submit
// Note: filter_var() requires PHP >= 5.2.0
if ( isset($_POST['email']) && isset($_POST['name']) && isset($_POST['subject']) && isset($_POST['message']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ) {
// detect & prevent header injections
$test = "/(content-type|bcc:|cc:|to:)/i";
foreach ( $_POST as $key => $val ) {
if ( preg_match( $test, $val ) ) {
exit;
}
}
$headers = 'From: ' . $_POST["name"] . '<' . $_POST["email"] . '>' . "\r\n" .
'Reply-To: ' . $_POST["email"] . "\r\n" .
'X-Mailer: PHP/' . phpversion();
//
mail( "kontakt@ristorante-sicilia-reinheim.de", $_POST['subject'], $_POST['message'], $headers );
// ^
// Replace with your email
}
?>
Alles anzeigen
Das Layout gefällt mir sehr gut nur die Technik macht Probleme.
Achja anzusehen unter