Skip to content

Pr4v33N-Sec/PHP-CRUD

Repository files navigation

PHP CRUD Application

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.


✨ Features

  • 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

🗂 Project Structure


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


⚙️ Setup Instructions

  1. Clone or download the repository
    Unzip the project files into your local web server's root directory (e.g., htdocs for XAMPP).

  2. Create the Database

    • Open phpMyAdmin
    • Create a new database (e.g., php_crud)
    • Create a table messages with 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
      );
  3. Configure Database Connection

    • Open conn/conn.php and update your DB credentials:
      $conn = mysqli_connect("localhost", "root", "", "php_crud");
  4. Run the App

    • Access http://localhost/PHP-CRUD-main/contact.html in your browser.

🧑‍💻 How It Works

  • Submit Message: contact.htmlcontact.php → DB
  • View Messages: contactusmessages.php fetches and displays all records
  • Edit Message: Click "Edit" → edit.php → pre-filled form → update.php
  • Delete Message: Click "Delete" → delete.php removes record

🛠 Technologies Used

  • Frontend: HTML, CSS, JavaScript
  • Backend: PHP (Procedural)
  • Database: MySQL
  • Hosting: Local server (XAMPP/LAMP/WAMP)

📷 Screenshots


🤝 Contribution

Feel free to fork the repository, improve the code, and submit pull requests.


📜 License

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!

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages