Introduction
In today’s digital world, managing laundry services manually is becoming outdated and inefficient. Whether you run a small laundry shop, manage hostel facilities, or handle apartment laundry services, keeping track of customer orders, payments, and delivery schedules can be overwhelming. This is where a Laundry Management System becomes essential.
A Laundry Management System using PHP and MySQL is a perfect project for students who want to learn web development while building something practical and useful. This system automates the entire laundry process from order placement to delivery tracking, making it easier for both customers and service providers to manage their laundry needs efficiently.
This project will help you understand important programming concepts like database connectivity, user authentication, session management, and CRUD operations. Let’s dive deep into building this comprehensive laundry management system.
What Is Laundry Management System?
A Laundry Management System is a web-based application where customers can place laundry orders online and admins can manage services, orders, and users from a dashboard.
| Project Name | Laundry Management System |
| Language Used | PHP |
| Database | MySQL |
| User Interface Design | HTML, CSS, JavaScript |
| Web Browser | Google Chrome |
| Software | XAMPP |
Step-by-Step Development Process
Step 1: Database Setup
First, create the MySQL database and required tables. Here’s the SQL code to set up your database:
-- Create Database
CREATE DATABASE laundry_management;
-- Use Database
USE laundry_management;
-- Users Table
CREATE TABLE users (
id INT(11) AUTO_INCREMENT PRIMARY KEY,
full_name VARCHAR(100) NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
phone VARCHAR(15) NOT NULL,
address TEXT NOT NULL,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Services Table
CREATE TABLE services (
id INT(11) AUTO_INCREMENT PRIMARY KEY,
service_name VARCHAR(100) NOT NULL,
price_per_kg DECIMAL(10,2) NOT NULL,
description TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Orders Table
CREATE TABLE orders (
id INT(11) AUTO_INCREMENT PRIMARY KEY,
user_id INT(11) NOT NULL,
service_id INT(11) NOT NULL,
quantity DECIMAL(5,2) NOT NULL,
total_amount DECIMAL(10,2) NOT NULL,
pickup_date DATE NOT NULL,
delivery_date DATE,
status ENUM('pending', 'processing', 'completed', 'cancelled') DEFAULT 'pending',
special_instructions TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id),
FOREIGN KEY (service_id) REFERENCES services(id)
);
-- Admin Table
CREATE TABLE admin (
id INT(11) AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Step 2: Database Connection
Create a database connection file (config.php) to connect PHP with MySQL:
<?php
// Database configuration
$servername = "localhost";
$username = "root";
$password = "";
$database = "laundry_management";
try {
// Create connection using PDO
$pdo = new PDO("mysql:host=$servername;dbname=$database", $username, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
} catch(PDOException $e) {
die("Connection failed: " . $e->getMessage());
}
?>
Step 3: User Registration System
Create a user registration form and processing script:
<!-- register.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>User Registration - Laundry Management</title>
<style>
.form-container { max-width: 400px; margin: 50px auto; padding: 20px; }
.form-group { margin-bottom: 15px; }
input, textarea { width: 100%; padding: 8px; margin: 5px 0; }
.btn { background-color: #4CAF50; color: white; padding: 10px 20px; border: none; cursor: pointer; }
</style>
</head>
<body>
<div class="form-container">
<h2>User Registration</h2>
<form action="register_process.php" method="POST">
<div class="form-group">
<label>Full Name:</label>
<input type="text" name="full_name" required>
</div>
<div class="form-group">
<label>Email:</label>
<input type="email" name="email" required>
</div>
<div class="form-group">
<label>Phone:</label>
<input type="tel" name="phone" required>
</div>
<div class="form-group">
<label>Address:</label>
<textarea name="address" required></textarea>
</div>
<div class="form-group">
<label>Password:</label>
<input type="password" name="password" required>
</div>
<button type="submit" class="btn">Register</button>
</form>
</div>
</body>
</html>
Step 4: Order Management System
Create an order placement system for users:
<?php
// place_order.php
session_start();
include 'config.php';
// Check if user is logged in
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$user_id = $_SESSION['user_id'];
$service_id = $_POST['service_id'];