
<?php
$name=trim((string)($_POST['name'] ?? '')); $email=trim((string)($_POST['email'] ?? '')); $message=trim((string)($_POST['message'] ?? ''));
if($name==='' || $email===''){ header('Location: /events.php?err=' . urlencode('Please complete the required fields.')); exit; }
$line = implode('|',[uniqid(),str_replace('|','/',$name),str_replace('|','/',$email),str_replace('|','/',$message),date('Y-m-d H:i:s')]) . PHP_EOL;
file_put_contents(__DIR__ . '/data/promo_entries.txt', $line, FILE_APPEND);
header('Location: /events.php?sent=1'); exit;
