<?php
require_once __DIR__ . '/includes/redirect_helper.php';
// Collect form data
$name = $_POST['name'] ?? '';
$email = $_POST['email'] ?? '';
$song = $_POST['song'] ?? '';
$artist = $_POST['artist'] ?? '';
$dedication = $_POST['dedication'] ?? '';

// Save request to file
$saveFile = __DIR__ . '/data/requests.txt';
$entry = "Name: $name\nEmail: $email\nSong: $song\nArtist: $artist\nDedication: $dedication\n---\n";
file_put_contents($saveFile, $entry, FILE_APPEND);

// Redirect back with success message
ah_redirect_back('/requests.php', ['sent' => 1]);
