|
Server IP : 82.197.83.136 / Your IP : 216.73.216.129 Web Server : LiteSpeed System : Linux us-bos-web1456.main-hosting.eu 4.18.0-553.84.1.lve.el8.x86_64 #1 SMP Tue Nov 25 18:33:03 UTC 2025 x86_64 User : u163988420 ( 163988420) PHP Version : 7.4.33 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : ON Directory (0755) : /home/u163988420/domains/aadinathmedicity.com/public_html/AACSITE/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
$meta_title = "Book Appointment with Cancer Specialist in Ajmer | Aadinath Medicity Hospital";
$meta_description = "Book an appointment with top cancer specialists in Ajmer at Aadinath Cancer Medicity. Schedule your oncology consultation today at the best cancer hospital in Ajmer. Call us now to confirm your slot!";
$meta_keywords = "book appointment cancer specialist Ajmer, oncology consultation Ajmer, contact best cancer hospital in Ajmer, doctor appointment Ajmer";
$canonical = "https://www.aadinathmedicity.com/book-appointment-ajmer";
?>
<?php
include 'header.php';
?>
<?php
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$city = $_POST['city'];
$state = $_POST['state'];
$pincode = $_POST['pincode'];
$doctor = $_POST['doctor'];
$appointment_date = $_POST['appointment_date'];
$sql = "INSERT INTO appointments (name, email, phone, city, state, pincode, doctor, appointment_date)
VALUES ('$name', '$email', '$phone', '$city', '$state', '$pincode', '$doctor', '$appointment_date')";
if (mysqli_query($conn, $sql)) {
$success_message = "Appointment successfully booked!";
} else {
$error_message = "Error: " . $sql . "<br>" . mysqli_error($conn);
}
}
$doctor_query = "SELECT name FROM doctors";
$doctor_result = mysqli_query($conn, $doctor_query);
?>
<!--Email Send-->
<?php
require 'admin/PHPMailer/src/Exception.php';
require 'admin/PHPMailer/src/PHPMailer.php';
require 'admin/PHPMailer/src/SMTP.php';
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$city = $_POST['city'];
$state = $_POST['state'];
$pincode = $_POST['pincode'];
$doctor = $_POST['doctor'];
$appointment_date = $_POST['appointment_date'];
// Create a new PHPMailer instance
$mail = new PHPMailer\PHPMailer\PHPMailer();
try {
//Server settings
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'aadinathmedicity@gmail.com'; // Your Gmail address
$mail->Password = 'tawssyskhixsfijk'; // Gmail App password (if 2FA is enabled)
$mail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_SMTPS;
$mail->Port = 465;
// Recipients
$mail->setFrom('aadinathmedicity@gmail.com', 'Aadinath Medicity Appointment Form');
$mail->addAddress('aadinathmedicity@gmail.com', 'Aadinath Medicity Appointment Form');
// Content
$mail->isHTML(true);
$mail->Subject = 'New Appointment Submission';
$mail->Body = "
<h3>Patient Appointment Details</h3>
<p>Name: $name</p>
<p>Email: $email</p>
<p>Phone: $phone</p>
<p>City: $city</p>
<p>State: $state</p>
<p>Pin Code: $pincode</p>
<p>Doctor: $doctor</p>
<p>Appointment Date: $appointment_date</p>
";
// Send email
if ($mail->send()) {
echo '<h1>Email sent successfully!</h1>';
} else {
echo '<h1>Message could not be sent. Mailer Error: ' . $mail->ErrorInfo . '</h1>';
}
} catch (Exception $e) {
echo "Message could not be sent. Error: {$mail->ErrorInfo}";
}
}
?>
<!-- Start Breadcrumb -->
<div class="breadcrumb-area text-center" style="margin-top: 130px;padding:70px; background-color: rgb(0, 38, 78);">
<div class="fixed-bg" style="background-image: url(assets/img/shape/9.png);"></div>
<div class="container">
<div class="row">
<div class="col-lg-8 offset-lg-2">
<h1>Appointment</h1>
<ul class="breadcrumb">
<li><a href="best-cancer-hospital-in-ajmer.php"><i class="fas fa-home"></i>Home</a></li>
<li class="active">Appointment</li>
</ul>
</div>
</div>
</div>
</div>
<!-- End Breadcrumb -->
<!-- Start Appointment Form Area -->
<div class="appointment-form-area" style="padding: 70px 0;">
<div class="container">
<div class="row">
<div class="col-lg-8 offset-lg-2">
<div class="appointment-form">
<h3>Book Your Appointment</h3>
<?php if (isset($success_message)) { ?>
<div class="alert alert-success"><?php echo $success_message; ?></div>
<?php } ?>
<?php if (isset($error_message)) { ?>
<div class="alert alert-danger"><?php echo $error_message; ?></div>
<?php } ?>
<form action="appointment.php" method="POST" class="appointment-form">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name" name="name" required>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" name="email" required>
</div>
<div class="form-group">
<label for="phone">Phone</label>
<input type="text" class="form-control" id="phone" name="phone" required>
</div>
<div class="form-group">
<label for="city">City</label>
<input type="text" class="form-control" id="city" name="city" required>
</div>
<div class="form-group">
<label for="state">State</label>
<input type="text" class="form-control" id="state" name="state" required>
</div>
<div class="form-group">
<label for="pincode">Pin Code</label>
<input type="text" class="form-control" id="pincode" name="pincode" required>
</div>
<div class="form-group">
<label for="doctor">Select Doctor</label>
<select class="form-control" id="doctor" name="doctor" required>
<?php while ($doctor = mysqli_fetch_assoc($doctor_result)) { ?>
<option value="<?php echo $doctor['name']; ?>"><?php echo $doctor['name']; ?></option>
<?php } ?>
</select>
</div>
<div class="form-group">
<label for="appointment_date">Appointment Date</label>
<input type="date" class="form-control" id="appointment_date" name="appointment_date" required>
</div>
<button type="submit" class="btn btn-primary" name="submit">Submit</button>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- End Appointment Form Area -->
<style>
.appointment-form-area {
background-color: #f7f7f7;
padding: 50px 0;
}
.appointment-form h3 {
text-align: center;
margin-bottom: 30px;
font-size: 32px;
color: #333;
}
.appointment-form .form-group {
margin-bottom: 20px;
}
.appointment-form .form-control {
padding: 12px;
border-radius: 5px;
border: 1px solid #ddd;
}
.appointment-form button {
background-color: #28a745;
color: white;
padding: 15px 30px;
border: none;
border-radius: 5px;
cursor: pointer;
}
.appointment-form button:hover {
background-color: #218838;
}
@media (max-width: 767px) {
.appointment-form {
padding: 20px;
}
.appointment-form h3 {
font-size: 24px;
}
.appointment-form button {
width: 100%;
}
}
</style>
<?php include 'footer.php'; ?>