0
0 Comments

Please send uml image for below code
PHP File with html, css, & js:
(Index.php)

Railway Ticket Booking

body {
font-family: ‘Segoe UI’, Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
margin: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.booking-form {
background: #ffffff;
padding: 30px;
border-radius: 15px;
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
width: 400px;
animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

.booking-form h2 {
font-size: 24px;
color: #388e3c;
margin-bottom: 20px;
text-align: center;
font-weight: 600;
}

.form-group {
margin-bottom: 15px;
text-align: left;
}

.form-group label {
font-size: 14px;
color: #555;
margin-bottom: 5px;
display: block;
}

.form-group input,
.form-group select {
width: 100%;
padding: 10px 12px;
border: 1px solid #ccc;
border-radius: 8px;
font-size: 14px;
transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
border-color: #388e3c;
outline: none;
}

#passenger_details h4 {
margin-top: 10px;
color: #388e3c;
}

#passenger_details input,
#passenger_details select {
margin-bottom: 10px;
border-radius: 8px;
padding: 8px;
width: 100%;
border: 1px solid #ccc;
}

.btn {
background-color: #388e3c;
color: #fff;
border: none;
padding: 12px 15px;
border-radius: 10px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
width: 100%;
transition: background-color 0.3s ease;
}

.btn:hover {
background-color: #2e7d32;
}

.btn:active {
transform: scale(0.98);
}

Railway Ticket Booking

Departure Station:

Arrival Station:

Departure Date:

Class:

Sleeper
AC
General

Number of Passengers:

Book Ticket

document.getElementById(‘passengers’).addEventListener(‘input’, function () {
const count = this.value;
const detailsDiv = document.getElementById(‘passenger_details’);
detailsDiv.innerHTML = ”;

for (let i = 0; i < count; i++) {
detailsDiv.innerHTML +=
Passenger ${i + 1}
Name:

Age:

Gender:

Male
Female
Other

;
}
});

(Output.php):
connect_error) {
die(“Connection failed: ” . $conn->connect_error);
}

if ($_SERVER[‘REQUEST_METHOD’] == ‘POST’) {
// Get form data
$departure_station = $_POST[‘departure_station’];
$arrival_station = $_POST[‘arrival_station’];
$departure_date = $_POST[‘departure_date’];
$train_class = $_POST[‘train_class’];
$passengers = $_POST[‘passengers’];

date_default_timezone_set(‘Asia/Kolkata’);

$date = date(‘Y-m-d H:i:s’);

// Insert booking data into database
$sql = “INSERT INTO railway (departure_station, arrival_station, departure_date, class, booking_date, no_of_passenger)
VALUES (?, ?, ?, ?, ?, ?)”;

$stmt = $conn->prepare($sql);
$stmt->bind_param(“sssssi”, $departure_station, $arrival_station, $departure_date, $train_class, $date, $passengers);

if ($stmt->execute()) {
$booking_id = $stmt->insert_id;

// Insert passenger details
$sql_passenger = “INSERT INTO passenger_details (rail_id, passenger_name, passenger_age, passenger_gender) VALUES (?, ?, ?, ?)”;
$stmt_passenger = $conn->prepare($sql_passenger);

for ($i = 0; $i bind_param(“isis”, $booking_id, $name, $age, $gender);
$stmt_passenger->execute();
}

echo “Booking Successful!”;
echo “

Booking ID: $booking_id

“;
} else {
echo “Error: ” . $stmt->error;
}

$stmt->close();
$conn->close();
}
?>

(Rail.sql):

— phpMyAdmin SQL Dump
— version 5.2.1
— https://www.phpmyadmin.net/

— Host: 127.0.0.1
— Generation Time: Jan 06, 2025 at 12:34 PM
— Server version: 10.4.32-MariaDB
— PHP Version: 8.2.12

SET SQL_MODE = “NO_AUTO_VALUE_ON_ZERO”;
START TRANSACTION;
SET time_zone = “+00:00”;

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;


— Database: rail

— ——————————————————–


— Table structure for table passenger_details

CREATE TABLE passenger_details (
id int(11) NOT NULL,
rail_id int(11) NOT NULL,
passenger_name varchar(200) NOT NULL,
passenger_age int(11) NOT NULL,
passenger_gender varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;


— Dumping data for table passenger_details

INSERT INTO passenger_details (id, rail_id, passenger_name, passenger_age, passenger_gender) VALUES
(1, 1, ‘harsha’, 21, ‘male’),
(2, 1, ‘madan’, 21, ‘male’);

— ——————————————————–


— Table structure for table railway

CREATE TABLE railway (
id int(11) NOT NULL,
arrival_station varchar(200) NOT NULL,
departure_station varchar(200) NOT NULL,
departure_date datetime NOT NULL,
class varchar(200) NOT NULL,
no_of_passenger int(11) NOT NULL,
booking_date datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;


— Dumping data for table railway

INSERT INTO railway (id, arrival_station, departure_station, departure_date, class, no_of_passenger, booking_date) VALUES
(1, ‘vijaywada’, ‘madurai’, ‘2024-01-10 00:00:00’, ‘sleeper’, 2, ‘2025-01-06 17:02:37’);


— Indexes for dumped tables


— Indexes for table passenger_details

ALTER TABLE passenger_details
ADD PRIMARY KEY (id);


— Indexes for table railway

ALTER TABLE railway
ADD PRIMARY KEY (id);


— AUTO_INCREMENT for dumped tables


— AUTO_INCREMENT for table passenger_details

ALTER TABLE passenger_details
MODIFY id int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;


— AUTO_INCREMENT for table railway

ALTER TABLE railway
MODIFY id int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

ChatGPT said:
ChatGPT

s Asked question January 6, 2025