N E T H R A N. W E D A G E

Loading

Cybersecurity undergraduate and web developer based in Sri Lanka, passionate about penetration testing, VAPT, and ethical hacking.

Home / Portfolio / Web Dev / Dreamway Education Website
cat ~/web/dreamway-education.md
Web Dev

Dreamway Education Website

01 Jun 2024 Web Live Site Client Project

Full company website for Dreamway Education — responsive design, PHP backend, contact form with mail integration, and SEO-optimised pages.

PHP MySQL Bootstrap SEO

Dreamway Education — Website Development

Dreamway Education Pvt Ltd is an education consultancy based in Ratnapura, Sri Lanka. This project involved designing and developing a full website from scratch using PHP and MySQL — covering course listings, student inquiry forms, an admin dashboard, and dynamic content management. The goal was a clean, professional web presence that reflects the institution's academic focus.

Project Info

  • Client: Dreamway Education Pvt Ltd — Ratnapura, Sri Lanka
  • Type: Education Consultancy Website
  • Stack: PHP, MySQL, HTML5, CSS3, JavaScript
  • Features: Course listings, inquiry forms, admin dashboard, blog

Step 1 — Planning and Requirements

The project started with gathering requirements from the client. Key deliverables were identified:

  • Public-facing pages — Home, About, Courses, Contact
  • Student inquiry form with email notification
  • Admin panel to manage courses and inquiries
  • Blog / news section for announcements
  • Mobile-responsive design across all pages

A sitemap and wireframe were produced before any code was written to align with the client's expectations early in the process.

Step 2 — Database Design

The MySQL database was designed around four core tables. The schema was kept normalised to avoid data redundancy:

-- Courses table
CREATE TABLE courses (
  id INT AUTO_INCREMENT PRIMARY KEY,
  title VARCHAR(255) NOT NULL,
  description TEXT,
  duration VARCHAR(100),
  fee DECIMAL(10,2),
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Inquiries table
CREATE TABLE inquiries (
  id INT AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(255) NOT NULL,
  email VARCHAR(255) NOT NULL,
  phone VARCHAR(20),
  course_id INT,
  message TEXT,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  FOREIGN KEY (course_id) REFERENCES courses(id)
);

Additional tables were created for blog_posts and admin_users with hashed passwords using password_hash() — never plain text.

Step 3 — Backend Development (PHP)

The backend was built using plain PHP with a simple MVC-style structure separating config, models, and views:

/dreamway
  /config
    db.php          -- PDO connection
  /includes
    header.php
    footer.php
  /admin
    dashboard.php
    courses.php
    inquiries.php
  /pages
    index.php
    about.php
    courses.php
    contact.php

All database queries use PDO with prepared statements to prevent SQL injection. Form inputs are sanitised with htmlspecialchars() before output to prevent XSS.

Step 4 — Inquiry Form and Email

The student inquiry form on the contact page submits via POST to a handler that validates input, inserts to the database, and sends a confirmation email using PHPMailer:

// Validate and sanitise input
$name  = htmlspecialchars(trim($_POST['name']));
$email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);

// Insert to DB using prepared statement
$stmt = $pdo->prepare(
  "INSERT INTO inquiries
   (name, email, phone, course_id, message)
   VALUES (?, ?, ?, ?, ?)"
);
$stmt->execute([$name,$email,$phone,$course,$message]);

// Send confirmation via PHPMailer
$mail->setFrom('noreply@dreamwayedu.lk');
$mail->addAddress($email);
$mail->Subject = 'Inquiry Received — Dreamway Education';
$mail->send();

The admin also receives a notification email for every new inquiry submitted through the site.

Step 5 — Admin Dashboard

A protected admin panel was built behind session-based authentication. Login is restricted to registered admin users only:

// Login handler
session_start();
$stmt = $pdo->prepare(
  "SELECT * FROM admin_users WHERE email = ?"
);
$stmt->execute([$email]);
$user = $stmt->fetch();

if ($user && password_verify($password, $user['password'])) {
  $_SESSION['admin'] = $user['id'];
  header('Location: dashboard.php');
}

From the dashboard, the admin can add, edit, and delete courses, view and respond to student inquiries, and publish blog posts. All admin pages check for a valid session before rendering.

Step 6 — Frontend and Responsive Design

The frontend was built with custom CSS using a mobile-first approach. No CSS frameworks were used — all layouts are built with Flexbox and CSS Grid to keep the codebase lightweight:

/* Responsive course grid */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  padding: 2rem 0;
}

/* Mobile breakpoint */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open { display: flex; flex-direction: column; }
}

JavaScript was used only for the mobile navigation toggle and form validation — keeping the page fast with no heavy dependencies.

Key Takeaways

  • PDO prepared statements are essential — never concatenate user input into SQL queries
  • Always hash passwords with password_hash() — never store plain text
  • Session-based auth must validate on every protected page — not just the login page
  • PHPMailer is more reliable than PHP's built-in mail() for transactional email
  • Mobile-first CSS with Grid and Flexbox avoids framework bloat on small projects
  • Separating config, includes, and pages keeps PHP projects maintainable as they grow

Tools Used

  • PHP 8 — backend logic and routing
  • MySQL — relational database with PDO
  • PHPMailer — inquiry and notification emails
  • HTML5 / CSS3 — semantic markup and responsive layout
  • JavaScript — mobile nav toggle and client-side validation
  • Apache — web server with .htaccess URL rewriting
  • VS Code — development environment
Project Info
Category Web Dev
Difficulty Client Project
OS / Target Web
Points Live Site
Date 01 Jun 2024
Tools Used
PHP MySQL Bootstrap JS