Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
146 lines (136 loc) · 5.43 KB

File metadata and controls

146 lines (136 loc) · 5.43 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Appointment Booking</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
.container {
max-width: 600px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h2 {
text-align: center;
color: #333;
}
label {
font-weight: bold;
}
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="time"],
select,
textarea {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #4caf50;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
input[type="submit"]:hover {
background-color: #45a049;
}
#message {
margin-top: 15px;
padding: 10px;
border-radius: 4px;
}
#message.success {
background-color: #d4edda;
color: #155724;
}
#message.error {
background-color: #f8d7da;
color: #721c24;
}
</style>
</head>
<body>
<div class="container">
<h2>Appointment Booking</h2>
<form id="appointmentForm">
<label for="name">Name:</label><br>
<input type="text" id="name" name="name" required><br>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email" required><br>
<label for="phone">Phone:</label><br>
<input type="tel" id="phone" name="phone" required><br>
<label for="date">Date:</label><br>
<input type="date" id="date" name="date" required><br>
<label for="time">Time:</label><br>
<input type="time" id="time" name="time" required><br>
<label for="service">Service:</label><br>
<select id="service" name="service" required>
<option value="">Select Service</option>
<option value="consultation">Consultation</option>
<option value="checkup">Checkup</option>
<option value="treatment">Treatment</option>
<!-- Add more options as needed -->
</select><br>
<label for="comment">Comment:</label><br>
<textarea id="comment" name="comment"></textarea><br>
<input type="submit" value="Book Appointment">
</form>
<div id="message"></div> <!-- Display success or error message here -->
</div>
<script>
document.getElementById("appointmentForm").addEventListener("submit", function(event) {
event.preventDefault(); // Prevent the form from submitting normally
var formData = new FormData(this); // Get form data
// Send form data via AJAX
var xhr = new XMLHttpRequest();
xhr.open("POST", "appointment_submit.php", true);
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
var response = JSON.parse(xhr.responseText);
if (response.messages && response.messages.success) {
// Display success message
document.getElementById("message").className = "success";
document.getElementById("message").innerHTML = response.messages.success;
// Clear the form
document.getElementById("appointmentForm").reset();
} else if (response.messages && response.messages.error) {
// Display error message
document.getElementById("message").className = "error";
document.getElementById("message").innerHTML = response.messages.error;
} else {
// Unknown error occurred
document.getElementById("message").className = "error";
document.getElementById("message").innerHTML = "Unknown error occurred.";
}
} else {
// Request failed
document.getElementById("message").className = "error";
document.getElementById("message").innerHTML = "Error: " + xhr.statusText;
}
}
};
xhr.send(formData); // Send form data
});
</script>
</body>
</html>
Morty Proxy This is a proxified and sanitized view of the page, visit original site.