File: /home/halcosmu/public_html/heritusalgorix.com/investment/contact.php
<?php
header('Content-Type: application/json');
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$name = trim($_POST['name'] ?? '');
$email = trim($_POST['email'] ?? '');
$phone = trim($_POST['phone'] ?? '');
$ownsRental = trim($_POST['ownsRental'] ?? '');
$propertyValue = trim($_POST['propertyValue'] ?? '');
$mortgageBalance = trim($_POST['mortgageBalance'] ?? '');
$cashOutAmount = trim($_POST['cashOutAmount'] ?? '');
$creditScore = trim($_POST['creditScore'] ?? '');
if (!$name || !$email || !$ownsRental || !$propertyValue || !$mortgageBalance || !$cashOutAmount || !$creditScore) {
echo json_encode(['success' => false, 'message' => 'Please fill in all required fields']);
exit;
}
$to = 'info@rideshareadvisors.com'; // your email
$subject = "Lead from HeritusAlgorix- Investment Property";
$body =
"Name: $name\n" .
"Email: $email\n" .
"Phone: $phone\n" .
"Owns Rental: $ownsRental\n" .
"Property Value: $propertyValue\n" .
"Mortgage Balance: $mortgageBalance\n" .
"Cash Out: $cashOutAmount\n" .
"Credit Score: $creditScore";
$headers = "From: $email";
if (mail($to, $subject, $body, $headers)) {
echo json_encode(['success' => true, 'message' => 'Message sent successfully']);
} else {
echo json_encode(['success' => false, 'message' => 'Mail sending failed. Try again later.']);
}
} else {
echo json_encode(['success' => false, 'message' => 'Invalid request']);
}
?>