php
php
Submitted: 2024-2025
Submitted By:
This is to certify that the following student of this institute have carried
out this micro- project work on “Develop a To-Do-List Web
Application. ”under the guidance of Prof. K. U. Koche in the
Department of Computer Technology during the session 2024-25. This
work has been done in the partial fulfilment of the award for in Diploma
in Computer Technology from Maharashtra State Board of Technical
Education, Mumbai.
SUBMITTED-BY
2. Aim of Micro-Project
Develop a To-Do-List web application
4. Literature Review
A To-Do List Web Application built using PHP allows users to manage and
organize tasks efficiently through a dynamic, server-side application. PHP, a
widely used server-side scripting language, offers the flexibility and simplicity
required to develop interactive and user-friendly web applications.
• Form Elements: Forms are used to accept user inputs, such as task titles and
descriptions, and also allow users to mark tasks as completed or delete them.
• Responsive Layout: CSS ensures that the application layout adjusts well to
different screen sizes, making it usable on both desktop and mobile devices.
Algorithm:
The To-Do List Application in PHP follows a systematic and user-friendly
approach for managing tasks. The system uses a web-based interface, allowing
users to create, view, edit, and delete tasks. Here's a step-by-step description of
the proposed methodology for managing tasks:
Step 1: Initialize Database and Session
• Database Setup: Initialize a MySQL database to store tasks and user
information.
o Create a tasks table with columns such as task_id, user_id,
task_title, task_description, status, and created_at.
o Create a users table to store user credentials (username and
password).
• Session Management: Use PHP sessions to handle user login and ensure
tasks are associated with specific users.
Step 2: Display a Menu-Driven Interface
• Login: The user can log into their account to view their personal tasks.
• Register: If the user doesn’t have an account, they can register.
• Logout: The user can log out once they are finished.
7. Action Plan
4. Implement part-A
5. Implement part-B
6. Final Report
7. Submission of final
report
Part B
Develop a To-Do-List web application
Rationale:
The rational for including “edit” and “delete” functionality in a to-do list
application is to enhance user control, flexibility, and productivity.
1. Aim of Micro-Project
Develop a To-Do-List web application
3. Course Outcomes
• Understanding Digital Marketing Basics
• Applying Digital Marketing for Startup Growth
4. Literature Review
A To-Do List Web Application built using PHP allows users to manage and
organize tasks efficiently through a dynamic, server-side application. PHP, a
widely used server-side scripting language, offers the flexibility and simplicity
required to develop interactive and user-friendly web applications.
• Form Elements: Forms are used to accept user inputs, such as task titles and
descriptions, and also allow users to mark tasks as completed or delete them.
• Responsive Layout: CSS ensures that the application layout adjusts well to
different screen sizes, making it usable on both desktop and mobile devices.
Algorithm:
The To-Do List Application in PHP follows a systematic and user-friendly
approach for managing tasks. The system uses a web-based interface, allowing
users to create, view, edit, and delete tasks. Here's a step-by-step description of
the proposed methodology for managing tasks:
Step 1: Initialize Database and Session
• Database Setup: Initialize a MySQL database to store tasks and user
information.
o Create a tasks table with columns such as task_id, user_id, task_title,
task_description, status, and created_at.
o Create a users table to store user credentials (username and
password).
• Session Management: Use PHP sessions to handle user login and ensure
tasks are associated with specific users.
Step 2: Display a Menu-Driven Interface
• Login: The user can log into their account to view their personal tasks.
• Register: If the user doesn’t have an account, they can register.
• Logout: The user can log out once they are finished.
<?php
// INSERT INTO `notes` (`sno`, `title`, `description`, `tstamp`) VALUES
(NULL, 'But Books', 'Please buy books from Store', current_timestamp());
$insert = false;
$update = false;
$delete = false;
// Connect to the Database
$servername = "localhost";
$username = "root";
$password = "";
$database = "database";
// Create a connection
$conn = mysqli_connect($servername, $username, $password, $database);
if(isset($_GET['delete'])){
$sno = $_GET['delete'];
$delete = true;
$sql = "DELETE FROM `notes` WHERE `sno` = $sno";
$result = mysqli_query($conn, $sql);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
if (isset( $_POST['snoEdit'])){
// Update the record
$sno = $_POST["snoEdit"];
$title = $_POST["titleEdit"];
$description = $_POST["descriptionEdit"];
if($result){
$insert = true;
}
else{
echo "The record was not inserted successfully because of this error ---> ".
mysqli_error($conn);
}
}
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-
to-fit=no">
</head>
<body>
<div class="form-group">
<label for="desc">Note Description</label>
<textarea class="form-control" id="descriptionEdit"
name="descriptionEdit" rows="3"></textarea>
</div>
</div>
<div class="modal-footer d-block mr-auto">
<button type="button" class="btn btn-secondary" data-
dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save changes</button>
</div>
</form>
</div>
</div>
</div>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search"
aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0"
type="submit">Search</button>
</form>
</div>
</nav>
<?php
if($insert){
echo "<div class='alert alert-success alert-dismissible fade show' role='alert'>
<strong>Success!</strong> Your note has been inserted successfully
<button type='button' class='close' data-dismiss='alert' aria-label='Close'>
<span aria-hidden='true'>×</span>
</button>
</div>";
}
?>
<?php
if($delete){
echo "<div class='alert alert-success alert-dismissible fade show' role='alert'>
<strong>Success!</strong> Your note has been deleted successfully
<button type='button' class='close' data-dismiss='alert' aria-label='Close'>
<span aria-hidden='true'>×</span>
</button>
</div>";
}
?>
<?php
if($update){
echo "<div class='alert alert-success alert-dismissible fade show' role='alert'>
<strong>Success!</strong> Your note has been updated successfully
<button type='button' class='close' data-dismiss='alert' aria-label='Close'>
<span aria-hidden='true'>×</span>
</button>
</div>";
}
?>
<div class="container my-4">
<h2>Add a Note to iNotes</h2>
<form action="/crud/index.php" method="POST">
<div class="form-group">
<label for="title">Note Title</label>
<input type="text" class="form-control" id="title" name="title" aria-
describedby="emailHelp">
</div>
<div class="form-group">
<label for="desc">Note Description</label>
<textarea class="form-control" id="description" name="description"
rows="3"></textarea>
</div>
<button type="submit" class="btn btn-primary">Add Note</button>
</form>
</div>
</tbody>
</table>
</div>
<hr>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
integrity="sha384-
J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJ
oZ+n"
crossorigin="anonymous"></script>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
integrity="sha384-
Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfo
oAo"
crossorigin="anonymous"></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity="sha384-
wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8i
fwB6"
crossorigin="anonymous"></script>
<script src="//cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function () {
$('#myTable').DataTable();
});
</script>
<script>
edits = document.getElementsByClassName('edit');
Array.from(edits).forEach((element) => {
element.addEventListener("click", (e) => {
console.log("edit ");
tr = e.target.parentNode.parentNode;
title = tr.getElementsByTagName("td")[0].innerText;
description = tr.getElementsByTagName("td")[1].innerText;
console.log(title, description);
titleEdit.value = title;
descriptionEdit.value = description;
snoEdit.value = e.target.id;
console.log(e.target.id)
$('#editModal').modal('toggle');
})
})
deletes = document.getElementsByClassName('delete');
Array.from(deletes).forEach((element) => {
element.addEventListener("click", (e) => {
console.log("edit ");
sno = e.target.id.substr(1);
</html> index.php
<?php
session_start();
// Database connection
$conn = new mysqli("localhost", "root", "", "database");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Initialize variables
$message = "";
$page = isset($_GET['page']) ? $_GET['page'] : 'login';
// Registration Logic
if (isset($_POST['register'])) {
$username = trim($_POST['username']);
$password = trim($_POST['password']);
if ($stmt->execute()) {
$message = "Registration successful. <a href='?page=login'>Login
here</a>";
} else {
$message = "Username already exists.";
}
} else {
$message = "All fields are required.";
}
}
// Login Logic
if (isset($_POST['login'])) {
$username = trim($_POST['username']);
$password = trim($_POST['password']);
if ($row = $result->fetch_assoc()) {
if (password_verify($password, $row['password'])) {
$_SESSION['user'] = $username;
header("Location: ?page=dashboard");
exit();
} else {
$message = "Invalid password.";
}
} else {
$message = "Username not found.";
}
} else {
$message = "All fields are required.";
}
}
// Logout Logic
if ($page == "logout") {
session_destroy();
header("Location: ?page=login");
exit();
}
2. Laptop HP 1
AMD RYZEN 16gb RAM,
512 SSD,
7. Skill Developed:
8.Conclusion
the To-Do List Web Application developed using PHP is an efficient and
user-friendly system designed to help individuals manage their tasks and
stay organized. Through its simple and intuitive interface, the application
allows users to easily add, view, edit, and delete tasks, ensuring that they
can efficiently manage their day-to-day activities.