Git Product home page Git Product logo

php-todo-list's Introduction

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!!!

php-todo-list's People

Contributors

sujon-ahmed avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.