prepare( 'INSERT INTO leads (Name, CompanyName, Email, Phone, PotentialAmount, Status) VALUES (?, ?, ?, ?, ?, ?)' ); $stmt->execute([ $name, $companyName, $email, $phone, $potentialAmount, 'New' // Default status ]); $_SESSION['success_message'] = 'Lead added successfully!'; } catch (PDOException $e) { // In a real app, log this error. $_SESSION['error_message'] = 'Failed to add lead. Please try again.'; } header('Location: index.php'); exit();