-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbooking.html
68 lines (60 loc) · 2.16 KB
/
booking.html
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
<!DOCTYPE html>
<html>
<head>
<title>Booking Form</title>
<link rel="stylesheet" type="text/css" href="css/bookingcss.css">
<script>
function validateForm() {
if (isEmpty(document.getElementById('data_3').value.trim())) {
alert('First name is required!');
return false;
}
if (isEmpty(document.getElementById('data_4').value.trim())) {
alert('Last name is required!');
return false;
}
if (!validateEmail(document.getElementById('data_5').value.trim())) {
alert('Email must be a valid email address!');
return false;
}
return true;
}
function isEmpty(str) { return (str.length == 0 || !str.trim()); }
function validateEmail(email) {
var re = "";
return isEmpty(email) || re.test(email);
}
</script>
</head>
<body>
<h1>Tour Booking</h1>
<div class="container">
<form method="POST" action="booking.php" name="form" onsubmit="return validateForm()">
<div class="textbox">
<input type="text" placeholder="First Name" name="customer_name" value="" onkeypress="return /[a-zA-Z]/i.test(event.key)" required>
</div>
<div class="textbox">
<input type="text" placeholder="Email" name="customer_email" value="" required pattern="[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9-]+.[a-z]{2,4}" title="Invalid Email">
</div>
<div class="textbox">
<input type="text" placeholder="Phone" name="phone" value="" onkeypress="return /[0-9]/i.test(event.key)" maxlength="10" pattern="([0-9]){10,}" required>
</div>
<!-- <div class="textbox">
<input type="text" placeholder="booking_date" name="booking_date" value="">
</div> -->
<div class="textbox">
<input type="text" placeholder="Number_of_people" name="number_of_people" value="" required>
</div>
<div class="textbox">
<input type="text" placeholder="city" name="city" value="" onkeypress="return /[a-zA-Z]/i.test(event.key)" required>
</div>
<div class="textbox">
<input type="text" placeholder="Destination" name="destination" value="" required>
</div>
<div class="btn">
<input name="submit" value="Submit" type="submit">
</div>
</form>
</div>
</body>
</html>