Abdulselam Nezif:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Java Reservation Form</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.4.0/css/all.min.css">
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
color: #333;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
}
.container {
max-width: 800px;
width: 100%;
background: white;
border-radius: 12px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
overflow: hidden;
}
.header {
background: #343a40;
color: white;
padding: 20px;
text-align: center;
}
.header h1 {
font-size: 28px;
margin-bottom: 5px;
}
.header p {
color: #adb5bd;
}
.form-container {
padding: 30px;
}
.form-section {
margin-bottom: 25px;
}
.section-title {
font-size: 18px;
color: #495057;
margin-bottom: 15px;
padding-bottom: 8px;
border-bottom: 2px solid #e9ecef;
font-weight: 600;
}
.row {
display: flex;
flex-wrap: wrap;
margin: 0 -10px;
}
.col {
flex: 1;
padding: 0 10px;
min-width: 250px;
margin-bottom: 15px;
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 8px;
font-weight: 500;
color: #495057;
}
.form-control {
width: 100%;
padding: 12px 15px;
border: 1px solid #ced4da;
border-radius: 6px;
font-size: 16px;
transition: all 0.3s;
}
.form-control:focus {
border-color: #80bdff;
outline: none;
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
select.form-control {
appearance: none;
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg
xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'
stroke='%235a5a5a' stroke-width='2' stroke-linecap='round' stroke-
linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline
%3e%3c/svg%3e");
background-repeat: no-repeat;
background-position: right 10px center;
background-size: 16px;
}
.btn {
display: inline-block;
font-weight: 500;
text-align: center;
vertical-align: middle;
cursor: pointer;
padding: 12px 24px;
font-size: 16px;
border-radius: 6px;
transition: all 0.3s;
border: none;
}
.btn-primary {
color: #fff;
background-color: #007bff;
}
.btn-primary:hover {
background-color: #0069d9;
transform: translateY(-2px);
}
.btn-secondary {
color: #fff;
background-color: #6c757d;
.btn-secondary:hover {
background-color: #5a6268;
}
.btn-container {
display: flex;
gap: 10px;
justify-content: flex-end;
margin-top: 20px;
}
.alert {
padding: 12px 15px;
border-radius: 6px;
margin-bottom: 20px;
display: none;
}
.alert-success {
color: #155724;
background-color: #d4edda;
border: 1px solid #c3e6cb;
}
.required::after {
content: " *";
color: #dc3545;
}
@media (max-width: 600px) {
.col {
flex: 100%;
}
.btn-container {
flex-direction: column;
}
.btn {
width: 100%;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1><i class="fas fa-calendar-check"></i> Java Reservation
System</h1>
<p>Book your appointment with ease</p>
</div>
<div class="alert alert-success" id="successAlert">
<strong>Success!</strong> Your reservation has been submitted.
</div>
<div class="form-container">
<form id="reservationForm">
<div class="form-section">
<div class="section-title">Personal Information</div>
<div class="row">
<div class="col">
<div class="form-group">
<label for="firstName" class="required">First
Name</label>
<input type="text" class="form-control" id="firstName"
placeholder="Enter your first name" required>
</div>
</div>
<div class="col">
<div class="form-group">
<label for="lastName" class="required">Last
Name</label>
<input type="text" class="form-control" id="lastName"
placeholder="Enter your last name" required>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group">
<label for="email" class="required">Email
Address</label>
<input type="email" class="form-control" id="email"
placeholder="Enter your email" required>
</div>
</div>
<div class="col">
<div class="form-group">
<label for="phone" class="required">Phone
Number</label>
<input type="tel" class="form-control" id="phone"
placeholder="Enter your phone number" required>
</div>
</div>
</div>
</div>
<div class="form-section">
<div class="section-title">Reservation Details</div>
<div class="row">
<div class="col">
<div class="form-group">
<label for="reservationDate"
class="required">Reservation Date</label>
<input type="date" class="form-control"
id="reservationDate" required>
</div>
</div>
<div class="col">
<div class="form-group">
<label for="reservationTime"
class="required">Reservation Time</label>
<input type="time" class="form-control"
id="reservationTime" required>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group">
<label for="partySize" class="required">Party
Size</label>
<select class="form-control" id="partySize" required>
<option value="">Select number of guests</option>
<option value="1">1 person</option>
<option value="2">2 people</option>
<option value="3">3 people</option>
<option value="4">4 people</option>
<option value="5">5 people</option>
<option value="6">6+ people</option>
</select>
</div>
</div>
<div class="col">
<div class="form-group">
<label for="reservationType"
class="required">Reservation Type</label>
<select class="form-control" id="reservationType"
required>
<option value="">Select reservation type</option>
<option value="dinner">Dinner</option>
<option value="lunch">Lunch</option>
<option value="breakfast">Breakfast</option>
<option value="event">Special Event</option>
<option value="meeting">Business
Meeting</option>
</select>
</div>
</div>
</div>
</div>
<div class="form-section">
<div class="section-title">Additional Information</div>
<div class="form-group">
<label for="specialRequests">Special Requests</label>
<textarea class="form-control" id="specialRequests"
rows="3" placeholder="Any special requests or requirements"></textarea>
</div>
</div>
<div class="btn-container">
<button type="reset" class="btn btn-secondary">Clear
Form</button>
<button type="submit" class="btn btn-primary">Submit
Reservation</button>
</div>
</form>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const form = document.getElementById('reservationForm');
const successAlert = document.getElementById('successAlert');
// Set minimum date to today
const today = new Date().toISOString().split('T')[0];
document.getElementById('reservationDate').setAttribute('min',
today);
form.addEventListener('submit', function(e) {
e.preventDefault();
// Simple form validation
const firstName = document.getElementById('firstName').value;
const lastName = document.getElementById('lastName').value;
const email = document.getElementById('email').value;
const phone = document.getElementById('phone').value;
const date = document.getElementById('reservationDate').value;
const time = document.getElementById('reservationTime').value;
const partySize = document.getElementById('partySize').value;
const type = document.getElementById('reservationType').value;
if (!firstName !lastName !email !phone !date !time !partySize || !
type) {
alert('Please fill in all required fields.');
return;
}
// Email validation
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailRegex.test(email)) {
alert('Please enter a valid email address.');
return;
}
// If all validation passes, show success message
successAlert.style.display = 'block';
// Scroll to the success message
successAlert.scrollIntoView({ behavior: 'smooth' });
// Hide the success message after 5 seconds
setTimeout(() => {
successAlert.style.display = 'none';
}, 5000);
// In a real application, you would send the data to a server here
console.log('Form submitted with data:', {
firstName, lastName, email, phone, date, time, partySize, type
});
});
});
</script>
</body>
</html>