diff --git a/contact.php b/contact.php index 2c23935..dbff358 100644 --- a/contact.php +++ b/contact.php @@ -15,48 +15,51 @@ if (!isset($_SESSION['captcha'])) { $_SESSION['captcha'] = [ 'num1' => rand(1, 10), 'num2' => rand(1, 10), - 'answer' => 0 // This will be calculated later + 'answer' => $_SESSION['captcha']['num1'] + $_SESSION['captcha']['num2'] ]; - $_SESSION['captcha']['answer'] = $_SESSION['captcha']['num1'] + $_SESSION['captcha']['num2']; } -// Check if form is submitted if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = trim($_POST['name']); $email = trim($_POST['email']); - $number = trim($_POST['number']); + $phone = trim($_POST['phone']); // Assuming you have a phone input field $subject = trim($_POST['subject']); $message = trim($_POST['message']); $captcha_input = isset($_POST['captcha']) ? (int)$_POST['captcha'] : 0; - // Validate CAPTCHA if ($captcha_input !== $_SESSION['captcha']['answer']) { echo "