-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodification.php
49 lines (31 loc) · 1.2 KB
/
modification.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
if(isset($_POST['delete']))
{
$id= filter_input(INPUT_POST, "delete", FILTER_SANITIZE_STRING);
$cnn = mysqli_connect("localhost", "Me", "1234", "ITEC327ToDoList");
$query = "delete from tasks
where id=?";
$stmt = mysqli_prepare($cnn, $query);
mysqli_stmt_bind_param($stmt, "i", $id);
mysqli_stmt_execute($stmt);
header("location:main.php");
}
else if(isset($_POST['saveEdit']))
{
$id= filter_input(INPUT_POST, "saveEdit", FILTER_SANITIZE_STRING);
$title = filter_input(INPUT_POST, "title$id", FILTER_SANITIZE_STRING);
$priority = filter_input(INPUT_POST, "priority$id", );
$status = filter_input(INPUT_POST, "status$id");
$description = filter_input(INPUT_POST, "description$id");
$due_date = filter_input(INPUT_POST, "dueDate$id");
$cnn = mysqli_connect("localhost", "Me", "1234", "ITEC327ToDoList");
$query = "update tasks
set title=?, description=?, due_date=?, priority=?, status=?
where id=?";
$stmt = mysqli_prepare($cnn, $query);
mysqli_stmt_bind_param($stmt, "sssssi", $title, $description, $due_date, $priority, $status,$id);
mysqli_stmt_execute($stmt);
header("location:main.php");
}
// Author: Morteza Farrokhnejad
?>