-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
136 lines (118 loc) · 4.87 KB
/
index.php
File metadata and controls
136 lines (118 loc) · 4.87 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Service Form</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<style>
body {
font-family: 'Poppins', sans-serif;
background: linear-gradient(135deg, rgba(72, 85, 99, 0.9), rgba(0, 212, 255, 0.9));
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
color: #ffffff;
}
.card {
background: linear-gradient(145deg, rgba(255, 255, 255, 0.85), rgba(217, 237, 255, 0.95));
border: none;
border-radius: 12px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.form-label {
color: rgb(41, 45, 49);
font-weight: 500;
}
.form-control,
.form-select {
background-color: #f8f9fa;
border-radius: 8px;
border: 1px solid #ced4da;
padding: 10px;
}
.btn-primary {
background-color: #007bff;
border: none;
transition: all 0.3s ease;
}
.btn-primary:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="container mt-5 mb-5">
<h2 class="text-center mb-4 fw-bold">Service Booking Form</h2>
<form id="serviceForm" class="card p-4" method="post" action="save_response.php">
<div class="mb-3">
<label for="name" class="form-label">Name:</label>
<input type="text" id="name" name="name" class="form-control" placeholder="Enter your full name"
required>
</div>
<div class="mb-3">
<label for="mobile" class="form-label">Mobile Number:</label>
<input type="text" id="mobile" name="mobile" class="form-control" placeholder="Enter your mobile number"
required>
</div>
<div class="mb-3">
<label for="email" class="form-label">Email:</label>
<input type="email" id="email" name="email" class="form-control" placeholder="Enter your email address"
required>
</div>
<div class="mb-3">
<label for="service" class="form-label">Service:</label>
<select id="service" name="service" class="form-select" required>
<option value="">Select a service</option>
</select>
</div>
<div class="mb-3">
<label for="subService" class="form-label">Sub-Service:</label>
<select id="subService" name="subService" class="form-select" required>
<option value="">Select a sub-service</option>
</select>
</div>
<div class="d-flex justify-content-center mt-3">
<button type="submit" class="btn btn-primary w-auto">Submit</button>
</div>
</form>
</div>
<script>
$(document).ready(function () {
$.ajax({
url: "get_services.php",
method: "GET",
success: function (response) {
const services = JSON.parse(response);
services.forEach(service => {
$('#service').append(`<option value="${service}">${service}</option>`);
});
}
});
$('#service').change(function () {
const selectedService = $(this).val();
if (selectedService) {
$.ajax({
url: "get_sub_services.php",
method: "GET",
data: { service: selectedService },
success: function (response) {
const subServices = JSON.parse(response);
$('#subService').empty().append('<option value="">Select a sub-service</option>');
subServices.forEach(subService => {
$('#subService').append(`<option value="${subService}">${subService}</option>`);
});
}
});
} else {
$('#subService').empty().append('<option value="">Select a sub-service</option>');
}
});
});
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>