[ "dates" => ["9-13 December", "16-20 December"], "sessions" => ["1100-1700"], "spots" => "unlimited" ], "Bowling in Vogelweh" => [ "dates" => ["9-13 December", "16-20 December"], "sessions" => ["1100-1700"], "spots" => "unlimited" ], "Cookie Decorating" => [ "dates" => [ "10 December" => ["1000-1100" => 35, "1300-1400" => 35], "11 December" => ["1000-1100" => 35, "1300-1400" => 35], "12 December" => ["1000-1100" => 35, "1300-1400" => 35] ] ], "Team Trivia" => [ "dates" => ["17 December"], "sessions" => ["1400-1600"], "spots" => "unlimited" ], "Wall Climbing" => [ "dates" => ["9-13 December", "16-20 December"], "sessions" => ["1000-1700"], "spots" => "unlimited" ], "Grinchmas Pool Party" => [ "dates" => ["9 December" => ["1300-1600" => 350], "16 December" => ["1300-1600" => 350]] ], "Paintball Tournament" => [ "dates" => [ "10 December" => ["1000-1200" => "unlimited", "1300-1500" => "unlimited"], "11 December" => ["1000-1200" => "unlimited", "1300-1500" => "unlimited"], "12 December" => ["1000-1200" => "unlimited", "1300-1500" => "unlimited"] ] ], "Golf Driving Range" => [ "dates" => ["9-13 December", "16-20 December"], "sessions" => ["0900-1600"], "spots" => "unlimited" ], "Rhine Christmas Markets" => [ "dates" => ["10 December" => ["0930-1800" => 100]] ], "Christmas Market Heidelberg" => [ "dates" => ["18 December" => ["0830-1700" => 100]] ] ]; // Initialize session data for spots if not already set if (!isset($_SESSION['spots'])) { $_SESSION['spots'] = $activities; } if ($_SERVER["REQUEST_METHOD"] == "POST") { // Get submitted form data $activity = $_POST['activity']; $date = $_POST['date']; $session = $_POST['session']; $numberOfPeople = (int)$_POST['numberOfPeople']; // Check if there are enough spots available if ($_SESSION['spots'][$activity]['dates'][$date][$session] === "unlimited" || $_SESSION['spots'][$activity]['dates'][$date][$session] >= $numberOfPeople) { // Decrease available spots for this session if limited if ($_SESSION['spots'][$activity]['dates'][$date][$session] !== "unlimited") { $_SESSION['spots'][$activity]['dates'][$date][$session] -= $numberOfPeople; } // Send an email confirmation $to = "amic@86fss.com"; $subject = "New Activity Registration"; $message = "Activity: $activity\nDate: $date\nSession: $session\nNumber of People: $numberOfPeople\n" . "Full Name: {$_POST['fullName']}\nUnit: {$_POST['unit']}\nEmail: {$_POST['email']}\nDSN: {$_POST['dsn']}"; $headers = "From: {$_POST['email']}"; mail($to, $subject, $message, $headers); echo "Registration successful! Confirmation email sent."; } else { echo "Sorry, not enough spots available for the selected session."; } } ?>

Activity Registration Form