This is a basic PHP-based CRUD (Create, Read, Update, Delete) application that allows users to manage contact messages and data stored in a MySQL database. It's ideal for beginners who want to understand how CRUD operations work using core PHP and MySQL.
- Add new contact messages via a form
- View all messages stored in the database
- Edit and update existing entries
- Delete messages
- Responsive frontend with basic CSS
- Simple JavaScript validation
PHP-CRUD-main/
│
├── conn/
│ └── conn.php # Database connection file
│
├── images/ # Image assets used in the contact page
│
├── .github/
│ └── workflows/laravel.yml # CI workflow (not directly relevant)
│
├── contact.html # Contact form frontend
├── contact.js # JavaScript validation for contact form
├── contact.php # Backend script to handle form submission
├── contactStyle.css # CSS styling for the contact form
├── contactusmessages.php # View all contact messages (Read)
├── delete.php # Delete a message
├── edit.php # Edit a message
├── update.php # Update a message after editing
├── success.php # Redirect/success message
└── README.md # Project documentation
-
Clone or download the repository
Unzip the project files into your local web server's root directory (e.g.,htdocsfor XAMPP). -
Create the Database
- Open phpMyAdmin
- Create a new database (e.g.,
php_crud) - Create a table
messageswith appropriate fields like:CREATE TABLE messages ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), email VARCHAR(255), message TEXT, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
-
Configure Database Connection
- Open
conn/conn.phpand update your DB credentials:$conn = mysqli_connect("localhost", "root", "", "php_crud");
- Open
-
Run the App
- Access
http://localhost/PHP-CRUD-main/contact.htmlin your browser.
- Access
- Submit Message:
contact.html→contact.php→ DB - View Messages:
contactusmessages.phpfetches and displays all records - Edit Message: Click "Edit" →
edit.php→ pre-filled form →update.php - Delete Message: Click "Delete" →
delete.phpremoves record
- Frontend: HTML, CSS, JavaScript
- Backend: PHP (Procedural)
- Database: MySQL
- Hosting: Local server (XAMPP/LAMP/WAMP)
Feel free to fork the repository, improve the code, and submit pull requests.
This project is open source and free to use for educational purposes.
---
Copy this into a `README.md` file in your project folder. Let me know if you want a version that includes screenshots, database schema images, or deployment tips!