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']; $business_type = $_POST['business_type']; $status = 'New'; try { $stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, origin, status, gender, profession, country, state, city, address, business_type ) VALUES (:name, :email, :phone, :formname, :note, :origin, :status, :gender, :profession, :country, :state, :city, :address, :business_type)"); $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->bindParam(':business_type', $business_type); $stmt->execute(); echo "Record added successfully"; } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } } ?> 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(); } } } ?>

Choose Date for filter

 
   |   
Delete

'; } ?>
'; ?> prepare($sql); $stmt->bindValue(':businessVertical', "%".$businessVertical."%"); $stmt->bindValue(':searchTerm', "%".$searchTerm."%"); $stmt->bindValue(':start_date', $start_date); $stmt->bindValue(':end_date', $end_date); $stmt->execute(); $totalRows = $stmt->fetchColumn(); // second & final query to get the page_view data $sql = "SELECT * FROM cleads WHERE business_type LIKE :businessVertical AND (name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm OR email LIKE :searchTerm ) AND time BETWEEN :start_date AND :end_date ORDER BY id DESC LIMIT :limit OFFSET :offset"; $stmt = $conn->prepare($sql); $stmt->bindValue(':businessVertical', "%".$businessVertical."%"); $stmt->bindValue(':searchTerm', "%$searchTerm%"); $stmt->bindValue(':start_date', $start_date); $stmt->bindValue(':end_date', $end_date); $stmt->bindValue(':limit', $resultsPerPage, PDO::PARAM_INT); $stmt->bindValue(':offset', $offset, PDO::PARAM_INT); $stmt->execute(); $leads = $stmt->fetchAll(PDO::FETCH_ASSOC); $totalResults = count($leads); $totalPages = ceil($totalRows / $resultsPerPage); $end_time = microtime(true); $execution_time = ($end_time - $start_time); $executionTime = substr($execution_time, 0, 6); // if($resultsPerPage <= $totalRows) echo "

".$resultsPerPage." Out of ".$totalRows." Leads in ".$executionTime." Seconds

"; // else echo "

".$totalRows." Leads

"; // Status Conditional Color foreach($leads as $lead){ $only_date =isset($lead['time']) ? substr($lead['time'], 0, 10): 'Not Available'; $lead_id = $lead['id']; $leadCountry = strlen($lead['country']) > 0 ? $lead['country'] . ($lead['state'] > 0 ? '/' : ' ') : ' '; if($lead['status'] == 'New'){$conditional_background_color = 'background-color: #D4FFFF; border: 1px solid #2C9C9C; border-radius: 5px; color: #2C9C9C; border-radius: 20px; text-align: center;';} elseif($lead['status'] == 'Contacted'){$conditional_background_color = 'background-color: #D0E9FF; border: 1px solid #1A91FF; border-radius: 5px; color: #1A91FF; border-radius: 20px; text-align: center;';} elseif($lead['status'] == 'Disqualified'){$conditional_background_color = 'background-color: #CECECE; border: 1px solid #3F4254; border-radius: 5px; color: #3F4254; border-radius: 20px; text-align: center;';} elseif($lead['status'] == 'Converted'){$conditional_background_color = 'background-color: #D4FDE7; border: 1px solid #40916C; border-radius: 5px; color: #40916C; border-radius: 20px; text-align: center;';} elseif($lead['status'] == 'Warm'){$conditional_background_color = 'background-color: #FFD9D9; border: 1px solid #FB5555; border-radius: 5px; color: #FB5555; border-radius: 20px; text-align: center;';} elseif($lead['status'] == 'Inactive'){$conditional_background_color = 'background-color: #FFD9D9; border: 1px solid #FB5555; border-radius: 5px; color: #FB5555; border-radius: 20px; text-align: center;';} // if status = warm then select // if($row['status'] == 'Warm'){$conditional_status = '

'.$row['status'].'

';}elseif($row['status'] != 'Warm'){$conditional_status = $row['status'];} ?> Error: " . $e->getMessage() . "

"; } // Output execution time ?>
Date Name Country / State ID Status Form Name Assigned to
'; ?>

Add Lead

Lead Information