setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(PDOException $e) { echo "Connection failed: " . $e->getMessage(); } if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $formname = 'crm-portal'; $note = $_POST['note']; $details = $_POST['details']; $status = 'New'; try { $stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, details, status) VALUES (:name, :email, :phone, :formname, :note, :details, :status)"); $stmt->bindParam(':name', $name); $stmt->bindParam(':email', $email); $stmt->bindParam(':phone', $phone); $stmt->bindParam(':formname', $formname); $stmt->bindParam(':note', $note); $stmt->bindParam(':details', $details); $stmt->bindParam(':status', $status); $stmt->execute(); echo "Record added successfully"; } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } } ?>