Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buy ticket page enhanced with toggle button #952

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,12 @@ <h2>What type of transportation do you prefer for your travels?</h2>
</a>
<div>

<a href="about.html"><i class="fas fa-info-circle"></i> About</a>
<a href="buy.html"><i class="fas fa-ticket-alt"></i> Buy Ticket</a>
<a href="sell.html"><i class="fas fa-tags"></i> Sell</a>
<a href="contactus.html"><i class="fas fa-envelope"></i> Contact</a>
<a href="contributor.html"><i class="fas fa-users"></i> Contributors</a>
<a href="login.html"><i class="fas fa-sign-in-alt"></i> Login</a>
<a href="index.html" style="text-decoration: none;"><i class="fas fa-home"></i> Home</a>
<a href="about.html" style="text-decoration: none;"><i class="fas fa-info-circle"></i> About</a>
<a href="buy.html" style="text-decoration: none;"><i class="fas fa-ticket-alt"></i> Buy Ticket</a>
Expand Down
83 changes: 83 additions & 0 deletions register.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
flex-direction: column; /* Stack elements vertically */
justify-content: flex-start; /* Align items at the top */
align-items: center; /* Center items horizontally */
Expand Down Expand Up @@ -83,6 +87,85 @@
}
</style>
</head>
<body>

<div class="registration-form">
<h2>Register</h2>
<div class="form-field">
<label for="email">Email</label>
<input type="email" id="email" placeholder="Enter your email" required>
</div>
<div class="form-field">
<label for="username">Username</label>
<input type="text" id="username" placeholder="Enter your username" required>
</div>
<div class="form-field">
<label for="mobile">Mobile</label>
<input type="text" id="mobile" placeholder="Enter your mobile number" required>
</div>
<div class="form-field">
<label for="password">Password</label>
<input type="password" id="password" placeholder="Enter your password" required>
</div>
<div class="form-field">
<button onclick="registerUser()">Register</button>
<a href="./index.html">Back to Home</a>
</div>
<div id="message" class="message"></div>
</div>

<script>
// JavaScript for registration logic and validation
function registerUser() {
const email = document.getElementById('email').value.trim();
const username = document.getElementById('username').value.trim();
const mobile = document.getElementById('mobile').value.trim();
const password = document.getElementById('password').value.trim();
const messageElement = document.getElementById('message');

// Basic validation
if (!email || !username || !mobile || !password) {
showMessage('All fields are required!', 'error');
return;
}

// Email validation
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailRegex.test(email)) {
showMessage('Invalid email format!', 'error');
return;
}

// Username validation
if (username.length < 3) {
showMessage('Username must be at least 3 characters long!', 'error');
return;
}

// Mobile number validation
if (!/^\d{10}$/.test(mobile)) {
showMessage('Mobile number must be 10 digits!', 'error');
return;
}

// Password validation
if (password.length < 6) {
showMessage('Password must be at least 6 characters long!', 'error');
return;
}

// If all validations pass, display success message
showMessage('Registration successful!', 'success');
}

// Function to display messages
function showMessage(message, type) {
const messageElement = document.getElementById('message');
messageElement.textContent = message;
messageElement.className = `message ${type}`;
}
</script>

<header>
<nav class="navbar">
<img src="https://ticket-booking-blue.vercel.app/images/4.jpeg" alt="" style="border-radius: 50%; height: 35px; width: 35px;">
Expand Down