Skip to content

Sujon-Ahmed/PHP-TODO-LIST

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Creating a Simple To Do List App in PHP

Body

In this repository we will create a Simple To-Do List App using PHP. PHP is a server-side scripting language designed primarily for web development. Using PHP, you can let your user directly interact with the script and easily to learned its syntax. It is mostly used by newly coders for its user-friendly environment.

So Let's do the coding...

Getting started:

First you have to download & install XAMPP or any local server that run PHP scripts. Here's the link for XAMPP server https://www.apachefriends.org/index.html.

And this is the link for the bootstrap that has been used for the layout https://getbootstrap.com/.

Creating Database

Open your database web server then create a database name in it db_task. After that, click Import then locate the database file inside the folder of the application then click ok.

Creating the Database Connection

Open your any kind of text editor(notepadd++, etc..). Then just copy/paste the code below then name it conn.php.


$conn = new mysqli("localhost", "root", "", "db_task");

if(!$conn){
    die("Error: Cannot connect to the database");
}

Note: Start PHP Opening and Closing tag

Creating The Interface

This is where we will create a simple form for our application. To create the forms simply copy and paste it into you text editor, then save it as shown below.

Index Page

add_query.php


require_once 'conn.php';
if(isset($_POST['add'])){
if($_POST['task'] != ""){
    $task = $_POST['task'];

    $conn->query("INSERT INTO `task` (`task`)VALUES('$task')");
    header('location:index.php');
}
}

update_task.php


require_once 'conn.php';
if($_GET['task_id'] != ""){
    $task_id = $_GET['task_id'];

    $conn->query("UPDATE `task` SET `status` = 'Done' WHERE `task_id` = $task_id") or die(mysqli_errno($conn));
    header('location: index.php');
}

delete_query.php


require_once 'conn.php';
if($_GET['task_id']){
    $task_id = $_GET['task_id'];

    $conn->query("DELETE FROM `task` WHERE `task_id` = $task_id") or die(mysqli_errno($conn));
    header("location: index.php");
}	

There you have it we successfully created a Simple To-Do List App using PHP. I hope that this simple project helps you to what you are looking for. For more updates and projects just kindly visit my profile. Sujon-Ahmed

Enjoy Coding!!!

Releases

No releases published

Packages

No packages published

Languages