The problem
Booking a train ticket still means juggling three jobs: finding which trains run on a route, checking whether a berth is free in the class you want, and tracking the booking through its PNR until the chart is prepared. The online railway ticket booking system built here puts all three jobs into one web application: a passenger searches trains, sees availability per coach and class, selects exact berths, pays the computed fare, and receives a 10-digit PNR whose status — confirmed, RAC or waitlisted — is checkable any time. Without such a system, a student has no working model of how reservation state changes: a free berth can be taken seconds later, a waitlisted ticket can confirm after a cancellation, and coach and berth are fixed only at chart preparation. This project demonstrates that whole lifecycle on sample data, so the reservation logic — not a live railway connection — is what the student builds and explains.
The passenger searches trains, picks berths and checks PNR status from the web app.
Follow the working sequence
How it works
Booking a ticket in this system follows one end-to-end chain: search, availability, selection, fare, booking, and status. A passenger enters the source and destination stations, a journey date and a travel class, and the system queries the train table for services on that route. Availability is then computed per coach and berth class — Sleeper, AC 3 Tier, AC 2 Tier, AC First and Chair Car — so the passenger sees how many berths are free in each class rather than a single train-level number. The passenger picks exact berths from a coach map, the system locks those berths for the booking and calculates the fare with tax, and the booking is saved with a generated 10-digit PNR. At any later point the passenger enters that PNR and the system reads the booking record to show confirmed, RAC or waitlisted status with coach, berth and chart state.
- The passenger registers or logs in, then enters source station, destination station, journey date and travel class on the search form.
- The backend queries the trains and routes tables and returns matching services with timings, duration and per-person fare for the chosen class.
- For the chosen train, availability is computed per coach and berth class from the seats table, showing free berth counts or the waitlist position when full.
- The passenger selects exact berths on the coach map; the system marks those berths as held for this booking so a second user cannot select the same berth.
- The fare is calculated from the class fare table times the number of berths, plus approximate 5% tax, and shown as a full breakup before checkout.
- On confirmation the booking is saved with a unique 10-digit PNR, the berths move from held to booked, and the booking appears under My Bookings.
- At any time the passenger enters the PNR on the status page, which reads the booking record and shows CNF, RAC or WL status with coach, berth and chart state.
- If a booking is cancelled by the user or admin, its berths return to the available pool and the earliest waitlisted booking is promoted, in order.
Tech stack:
- PHP 8 with MySQL for the booking backend
- HTML5, CSS3 and JavaScript for the interface
- Apache web server through XAMPP
- Bootstrap 5 for the responsive layout
- phpMyAdmin for database management
- AJAX and JSON for live availability updates
- Session-based login for user and admin roles
- Payment gateway shown as a simulated demo flow only
| Parameter | Value |
|---|---|
| Classes supported | 5 classes (SL · 3A · 2A · 1A · CC) |
| PNR length | 10 digits (railway standard) |
| Max berths per booking | 4 berths (design limit) |
| Berths per AC 3-tier coach | 64 berths (design model) |
| Trains in demo data | 5 sample trains |
| Database tables | 8 tables (design) |
| Search response | Approximately under 1 second on local XAMPP (expected) |
| Fare tax | 5% GST (approximate · demo calculation) |
| Double-booking guard | 1 booking per berth · atomic seat decrement (design) |
| Hosting | Apache + MySQL · XAMPP local or shared hosting (expected) |
Project features
The system is built around four capabilities that do the real work. Train search with filters lets a passenger find services by route, date and class and compare timings and fares before choosing. Berth-wise seat availability shows exactly how many berths are free in each coach and class, including waitlist position when a class is full, so the passenger never books blind. Interactive seat selection turns that availability into a coach map where individual berths — lower, middle, upper, side lower and side upper — can be picked and locked for the booking. And PNR status lookup turns the 10-digit booking reference into a live answer: confirmed with coach and berth, RAC with a shared berth, or waitlisted with a position that moves as cancellations free berths. Around these sit fare calculation, a booking history page and an admin panel for trains, fares and cancellations.
- [Train Search with Filters] Search trains by source station, destination station, journey date and travel class, with departure and arrival times, duration and per-person fare shown for every matching service. [Implemented]
- [Berth-wise Seat Availability] Availability is computed per coach and berth class — Sleeper, AC 3 Tier, AC 2 Tier, AC First and Chair Car — instead of one train-level number, and shows the waitlist position when a class is full. [Implemented]
- [Interactive Seat Selection] A coach map shows every berth with its type (LB, MB, UB, SL, SU); free berths can be selected, booked berths are locked out, and up to 4 berths can be chosen in one booking. [Implemented]
- [Fare Calculation with Tax] The fare is calculated from the class fare table multiplied by the number of berths selected, with an approximate 5% tax added and the full breakup shown before payment. [Implemented]
- [Booking with 10-digit PNR] A confirmed booking generates a unique 10-digit PNR, the railway standard for a booking reference, which is the single key for all later status checks. [Implemented]
- [PNR Status Lookup] Entering a PNR returns the booking status — CNF with coach and berth, RAC with a shared berth, or WL with a position — plus train, route, date, fare and chart-preparation state. [Implemented]
- [Admin Panel] The admin manages trains, routes, class fares and bookings, and can cancel a booking, which returns its berths to the available pool and can promote waitlisted passengers. [Implemented]
- [My Bookings History] Logged-in users see all their bookings with PNR, train, date, coach, berth and current status in one list, so no booking is lost after checkout. [Implemented]
Optional customizations (not included in the base build): live payment gateway integration, SMS or email ticket delivery, Tatkal quota handling, live train running-status feed, and a mobile app version.
What is included
- Complete PHP and MySQL source code for user and admin modules
- MySQL database schema with sample trains, routes, fares and bookings
- Working single-file demo of search, seat selection and PNR lookup
- Project report PDF (background, methodology, architecture, results)
- PPT presentation for final review
- Viva Q&A preparation document (reservation logic, PNR lifecycle, concurrency, database design)
- Setup instructions for XAMPP installation and database import
Limitations & prerequisites
- The demo runs on sample train, fare and PNR data; it is not connected to IRCTC or any live railway reservation system and cannot book a real ticket.
- Payment is a simulated demo flow — no real payment gateway is integrated in the base build, so no real money can be charged.
- Seat availability is computed from the local database only; there is no live train running-status or real-time chart feed.
- One booking holds at most 4 berths, a design limit chosen for the student build, not a railway rule.
- Chart preparation is simulated in the demo; real chart timing follows railway rules and is outside this system.
- The system is an academic build, not a production reservation platform — no claim is made about handling real passenger load or concurrent traffic at railway scale.
Frequently Asked Questions
Is this project suitable for a final-year project?
Yes — for Computer Science and Information Technology final-year projects. It demonstrates database design across trains, routes, fares, seats and bookings, session-based authentication with user and admin roles, state management through the PNR lifecycle, and a real concurrency problem — preventing two users from booking the same berth — solved with an atomic seat decrement. The report and viva material explain each of these for the review.
Does it connect to IRCTC or book real tickets?
No. The system is a student build that runs entirely on sample train, fare and PNR data stored in its own MySQL database, and it is not connected to IRCTC or any live railway reservation system, so no real ticket can be booked through it. The demo footer states this plainly. What it demonstrates is the reservation logic itself — search, availability, berth locking, fare calculation and PNR status — which is the part a student is expected to design and explain.
Is payment gateway integration included?
No — the base build does not include a real payment gateway. Checkout is a simulated demo flow that walks through the payment step without charging anything, while the fare calculation, including the approximate 5% tax breakup, is fully implemented. A real gateway such as Razorpay or UPI is an optional customization, and the demo notes the simulation at the checkout step. This keeps the project honest about what is real and what is a stand-in, and the report explains where the gateway hand-off would plug in.
How does seat availability avoid double booking?
Availability is stored per coach and berth, not per train, and a berth is decremented with a single atomic database update that only succeeds while seats remain, so only the first of two simultaneous bookings wins. Building the demo showed why this matters: two users can both see the last berth as free at the same instant, so a read-then-write in two steps would let both book it. The demo coach map also locks already-booked berths out of selection.
What is the main technology used?
PHP 8 with MySQL on an Apache server, run locally through XAMPP, with HTML, CSS, JavaScript and Bootstrap 5 for the interface, and AJAX calls that fetch live availability without reloading the page. The database holds 8 tables covering users, trains, routes, class fares, coaches, seats, bookings and passengers. Session-based login separates the passenger role from the admin role, which manages trains, fares and bookings.
Can it be hosted online and customized?
Yes — it runs on any standard Apache and MySQL shared hosting account after importing the database and updating the connection settings, and the setup guide covers both local XAMPP and online hosting, so deployment needs no special server software. Realistic customizations include adding a live payment gateway, SMS or email ticket delivery, Tatkal quota handling, a live running-status feed, more stations and trains, and a mobile app version, all of which can be developed on request.
Components & software requirements
- PHP 8 with MySQL for the booking backend
- HTML5, CSS3 and JavaScript for the interface
- Apache web server through XAMPP
- Bootstrap 5 for the responsive layout
- phpMyAdmin for database management
- AJAX and JSON for live availability updates
- Session-based login for user and admin roles
- Payment gateway shown as a simulated demo flow only
Delivery information
Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.
Support terms
Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.
Download free synopsis (PDF)
Enter your name and WhatsApp number — the synopsis PDF downloads immediately. We may send occasional project updates on WhatsApp; no spam.