Files
crm_php/.hta_slug/cleads/add-lead.php
dev sp ca6af2f5e2 init
2024-04-29 12:55:11 +00:00

63 lines
2.6 KiB
PHP

<?php
require_once('/var/www/html/.hta_config/crm_config.php');
require_once('/var/www/html/.htac_header.php');
require_once('/var/www/html/.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>