Added updated RSVP-form
This commit is contained in:
Executable
+38
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] !== "POST") {
|
||||
exit("Invalid request");
|
||||
}
|
||||
|
||||
/* Honeypot spam protection */
|
||||
if (!empty($_POST['website'])) {
|
||||
exit; // silently drop bot submission
|
||||
}
|
||||
|
||||
/* Safely read form fields */
|
||||
$first_name = htmlspecialchars($_POST['first_name'] ?? '');
|
||||
$last_name = htmlspecialchars($_POST['last_name'] ?? '');
|
||||
|
||||
$drinks = isset($_POST['drinks']) ? implode(", ", $_POST['drinks']) : "None";
|
||||
$allergies = htmlspecialchars($_POST['allergies'] ?? '');
|
||||
|
||||
if (!$first_name || !$last_name) {
|
||||
exit("Missing required fields");
|
||||
}
|
||||
|
||||
/* Email setup */
|
||||
$to = "hochzeit@markinstefan.xyz";
|
||||
$subject = "New Wedding RSVP from $first_name $last_name";
|
||||
|
||||
$message = "Name: $first_name $last_name\n";
|
||||
$message .= "Drinks: $drinks\n";
|
||||
$message .= "Allergies: $allergies\n";
|
||||
|
||||
$headers = "From: no-reply@yourdomain.com\r\n";
|
||||
$headers .= "Reply-To: no-reply@yourdomain.com\r\n";
|
||||
|
||||
/* Send mail */
|
||||
mail($to, $subject, $message, $headers);
|
||||
|
||||
echo "Thank you! Your RSVP has been sent.";
|
||||
?>
|
||||
Reference in New Issue
Block a user