false, 'error' => 'Missing field(s).']); exit; } $timestamp = date('Y-m-d H:i:s'); $entry = "[$timestamp]\n" . "Name & Surname: $fullname\n" . "Age: $age\n" . "Favorite Color: $color\n" . str_repeat('-', 30) . "\n"; // Append to panel.txt on the SERVER's filesystem. This file is never // sent back to the visitor's browser or offered as a download. $result = @file_put_contents($panelFile, $entry, FILE_APPEND | LOCK_EX); if ($result === false) { http_response_code(500); echo json_encode(['ok' => false, 'error' => 'Could not write to panel.txt. Check folder permissions.']); exit; } echo json_encode(['ok' => true]);