Skip to content

Maelstrom-64/WebDevCookbook

Repository files navigation

🍳 The Simple Cookbook A web-based application for managing personal recipes. This project allows users to browse a collection of recipes and acts as a management system to Add, Update, and Delete recipes and their specific ingredients.

📝 Project Description This project was developed as a university assignment to demonstrate Database Management Systems (DBMS) and Web Development concepts. It features a relational database schema to handle recipes, ingredients, and measurements, and uses a PHP backend to handle CRUD (Create, Read, Update, Delete) operations.

The application follows the Post-Redirect-Get (PRG) pattern to ensure smooth form handling and user feedback.

✨ Features Recipe Browser: View a list of all available recipes sorted alphabetically.

Recipe Details: View detailed instructions and ingredients for specific items.

Dynamic Editor:

Add new recipes.

Add ingredients dynamically using JavaScript (add/remove rows).

Create new ingredients on the fly if they don't exist in the database.

Update System: Edit existing recipes and modify their ingredients.

Delete System: Safely delete recipes (handles Foreign Key constraints automatically).

Feedback System: "Operation Receipts" provide clear success or error messages after every action.

🛠️ Technologies Used Frontend: HTML5, CSS3, JavaScript (Vanilla).

Backend: PHP (Procedural style).

Database: MySQL / MariaDB.

Server: Apache (via XAMPP).

📂 Project Structure Plaintext

/cookbook ├── css/ # Stylesheets (Bootstrap or custom CSS) ├── menu.php # Main landing page (List of recipes) ├── index.php # The "Editor" form (Insert/Update/Delete) ├── details.php # Page to view a single recipe's details ├── handle_operation.php # PHP Backend logic (Validates and processes SQL) ├── operation_receipt.php # Feedback page (Success/Error messages) └── cookbook.sql # Database export file ⚙️ Setup & Installation To run this project locally, follow these steps:

Install XAMPP (or WAMP/MAMP).

Clone the Repository:

Bash

git clone https://github.com/YourUsername/Simple-Cookbook.git Move Files: Move the project folder into your server directory (e.g., C:\xampp\htdocs\cookbook).

Setup Database:

Open phpMyAdmin (http://localhost/phpmyadmin).

Create a new database named cookbook.

Import the cookbook.sql file provided in this repository.

Configure Connection:

Open handle_operation.php, menu.php, and index.php.

Ensure the DEFINE constants match your local database settings:

PHP

DEFINE('DB_USER', 'root'); DEFINE('DB_PASSWORD', ''); DEFINE('DB_PORT', 3306);
Run: Open your browser and go to http://localhost/cookbook/menu.php.

🗄️ Database Schema The project uses a normalized relational database:

recipe: Stores recipe metadata (ID, Name, Description, Portion).

ingredients: List of all possible ingredients.

measurement_units: Units like tsp, tbsp, cup, grams.

measurement_qty: Standardized quantities (0.5, 1, 100, etc.).

recipe_ingredients: The linking table that joins a Recipe to its Ingredients, Quantities, and Units.

📚 Learning Outcomes This project implements the following core concepts:

PHP Sessions ($_SESSION): Used to pass error messages between pages.

Database Connectivity (mysqli): Connecting PHP to MySQL.

Input Validation: Server-side checking for empty fields and required data.

Redirection (header): Using the "Relocation Technique" to prevent form resubmission.

Output Buffering (ob_start): Managing header outputs to avoid errors.

👥 Contributors Mahaz khan and hamza luai: Backend Logic (handle_operation.php) & Receipt System (operation_receipt.php).

AHMED YACINE, HAMZAH: Recipe List & Main Menu (menu.php).

Emad: Edit Menu Form & JavaScript (index.php).

About

Repository for the Development of Web Applications course project.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors