Files
crm_php/.hta_slug/cleads/add-lead.php
2024-05-01 18:13:22 +05:30

63 lines
2.6 KiB
PHP

<?php
require_once('.hta_config/crm_config.php');
require_once('.htac_header.php');
require_once('.htac_nav.php');
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->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();
}
}
?>
<div style="max-width: 600px;">
<form action="" method="post">
<div style="display: flex; flex-direction: column;">
<label for="name">Name:</label>
<input type="text" name="name" id="name" />
</div>
<div style="display: flex; flex-direction: column;">
<label for="email">E-mail:</label>
<input type="text" name="email" id="email" />
</div>
<div style="display: flex; flex-direction: column;">
<label for="phone">Phone:</label>
<input type="text" name="phone" id="phone" />
</div>
<div style="display: flex; flex-direction: column;">
<label for="details">Details:</label>
<input type="text" name="details" id="details" />
</div>
<div style="display: flex; flex-direction: column;">
<label for="note">Note:</label>
<textarea type="text" name="note" id="note" rows="6" cols="10"></textarea>
</div>
<div style="display: flex; flex-direction: column;">
<input type="submit" name="submit" id="submit" value="Submit"/>
</div>
</form>
</div>