setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(PDOException $e) { echo "Connection failed: " . $e->getMessage(); } if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['new_lead']) && isset($_POST['name']) && isset($_POST['phone']) ) { $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $formname = 'crm-portal'; $note = $_POST['note']; $origin = $_POST['origin']; $gender = $_POST['gender']; $profession = $_POST['profession']; $country = $_POST['country']; $state = $_POST['state']; $city = $_POST['city']; $address = $_POST['address']; $status = 'New'; try { $stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, origin, status, gender, profession, country, state, city, address ) VALUES (:name, :email, :phone, :formname, :note, :origin, :status, :gender, :profession, :country, :state, :city, :address)"); $stmt->bindParam(':name', $name); $stmt->bindParam(':email', $email); $stmt->bindParam(':phone', $phone); $stmt->bindParam(':formname', $formname); $stmt->bindParam(':note', $note); $stmt->bindParam(':origin', $origin); $stmt->bindParam(':status', $status); $stmt->bindParam(':gender', $gender); $stmt->bindParam(':profession', $profession); $stmt->bindParam(':country', $country); $stmt->bindParam(':state', $state); $stmt->bindParam(':city', $city); $stmt->bindParam(':address', $address); $stmt->execute(); echo "Record added successfully"; } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } } ?> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $delete_placeholders = rtrim(str_repeat('?,', count($selectedIds)), ','); $stmt = $conn->prepare("DELETE FROM cleads WHERE id IN ($delete_placeholders)"); foreach($selectedIds as $key => $id) { $stmt->bindValue($key + 1, $id, PDO::PARAM_INT); } $stmt->execute(); } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } } } ?>
Lead Management
Add Lead
✘