Skip to content

Aleks334/comment-system-pwi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Comment System Project

Getting Started

This project contains a simple comment system allowing users to read, add, edit, and delete comments (CRUD operations). The system is built using a combination of PHP for server-side logic and JavaScript for client-side interactivity. Comments are stored in a MySQL database.

Main Page Comment Form

Setup

To run this project locally, follow these steps:

  1. Server Environment:

    • Set up a local server environment such as XAMPP, WAMP, or your preferred alternative.
  2. Database Setup:

    • Create a new database called 'comment_system' using PHPMyAdmin or any MySQL database management tool.

    • Run the following SQL commands to set up the 'comments' table:

      CREATE DATABASE IF NOT EXISTS comment_system;
      USE comment_system;
      
      CREATE TABLE IF NOT EXISTS comments (
          id INT AUTO_INCREMENT PRIMARY KEY,
          name VARCHAR(100) NOT NULL,
          comment TEXT NOT NULL,
          submit_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  3. Clone the Repository:

    • Clone this repository to your local machine.
  4. Run the Project:

    • Open the project in your chosen server environment.
    • Access the project through your web browser.

Features:

  1. View Comments:

    • Display all comments on the main page (index.php).
    • Each comment shows the author, creation date, and message.
  2. Add New Comment:

    • Users can write and submit new comments through the "Write a comment" form.
  3. Edit Comment:

    • Edit existing comments by clicking the "Edit" button.
    • Redirects to the commentForm.php page for editing.
  4. Delete Comment:

    • Delete comments with a confirmation prompt.
    • Dynamically updates the DOM to remove the deleted comment.
  5. Comment Form:

    • commentForm.php handles both adding new comments and editing existing ones.
    • Uses the Fetch API to communicate with PHP for server-side operations.
  6. Response Handling:

    • Responses from server-side actions are displayed as message boxes with appropriate styling.
    • Alerts indicate success, blank input errors, or fatal errors.
  7. Redirect to Home:

    • App redirects users to the main page after a successful operation of adding/editing comment.

Note:

This project does not include a login system or role system.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published