This is a simple TODO list application built using PHP, JavaScript, and MySQL. The application allows users to add, delete, and view tasks.
- Add new tasks
- Delete existing tasks
- View all tasks
- Alerts for task addition
- PHP 7.4 or higher
- MySQL 5.7 or higher
- XAMPP or any other local server environment
-
Clone the repository to your local machine:
git clone https://github.com/yourusername/todo.git
-
Navigate to the project directory:
cd todo
-
Start your local server (e.g., XAMPP) and ensure Apache and MySQL are running.
-
Create a database named
todo
and import thetodo.sql
file to set up the database schema and initial data:
-
I have used gui to create table and database manually from xampp myPHP admin panel.
CREATE DATABASE todo; USE todo; SOURCE path/to/todo.sql;
-
Update the database connection details in db.php:
// filepath: /C:/xampp/htdocs/TODO/db.php <?php $servername = "localhost"; $username = "yourUsername"; $password = "yourPass"; $dbname = "yourDatabaseName"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } ?>
-
Open your browser and navigate to
http://localhost/todo
.
- [index.php]: The main file that displays the TODO list and handles task addition and deletion.
- [db.php]: Contains the database connection details.
- [fetchData.php]: Contains the function to fetch all tasks from the database.
- [delete.php]: Contains the function to delete a task from the database.
- [add.php]: Handles the addition of new tasks.
- [alert.php]: Displays success and error messages.
- [styles.css]: Contains the CSS styles for the application.
-
Add a Task:
- Enter the task in the input field and click the "Add" button.
- If the task is added successfully, a success message will be displayed.
- If the task is not added, an error message will be displayed.
-
Delete a Task:
- Click the delete button (trash icon) next to the task you want to delete.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
- Font Awesome for the icons.
- XAMPP for the local server environment.