-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnote2.php
More file actions
124 lines (122 loc) · 3.79 KB
/
note2.php
File metadata and controls
124 lines (122 loc) · 3.79 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!DOCTYPE html>
<html>
<head>
<title>Todo App</title>
<style type="text/css">
body{
background-color: #cdffff;
}
fieldset{
background-color: #ffffcc;
}
p{
display: inline;
}
.display{
background-color: #ffffcc;
border: 2px solid black;
padding: 10px;
width: 45%;
float: left;
margin: 17px;
}
</style>
</head>
<body>
<form method="post" action="red.php">
<fieldset>
<legend style="color:blue ; text-align:center ; font-size: 30px">Enter new note</legend>
<p>Heading: <input type="text" name="heading"></p> <br><br>
<p>Due-date: <input type="date" name="end"></p> <br><br>
<p>Status: <input type="radio" name="status" value="completed" > Completed
<input type="radio" name="status" value="not completed" checked> Not completed</p><br><br>
<p>Content: </p><br><textarea rows="10" cols="40" name="content"></textarea> <br><br>
<input type="submit" value="Create">
</fieldset>
</form>
<br>
<br>
<div class="display">
<h1 style="color:blue;text-align:center">Tasks to do</h1>
<?php
$server = "localhost";
$user = "root";
$password = "ag97";
$db = "note";
$conn = new mysqli($server,$user,$password,$db);
$query = "SELECT * FROM note ORDER BY id DESC";
if($result = $conn->query($query)){
while($row = $result->fetch_assoc()){
?>
<form method="post" action="edit.php">
<input type="text" name="id" value=" <?php echo $row['id'];?> " hidden>
<p>Heading:</p>
<input type="text" name="heading" value=" <?php echo $row['heading'];?> "><br><br>
<p>Due-date:</p>
<input type="date" name="end" value="<?php echo date('Y-m-d',strtotime($row['end'])) ?>"><br><br>
<?php
if($row['status'] == "completed" ){
echo "<p>Status: <input type='radio' name='status' value='completed' checked> Completed
<input type='radio' name='status' value='not completed' > Not completed</p><br><br>";
}
else
{
echo "<p>Status: <input type='radio' name='status' value='completed' > Completed
<input type='radio' name='status' value='not completed' checked> Not completed</p><br><br>";
}
?>
<p>Content:</p>
<input type="text" name="content" value=" <?php echo $row['content'];?> "><br><br>
<input type="submit" name="changes" value="Save changes"> <input type="submit" name="delete" value="Delete">
</form><br><br><hr><br>
<?php
}
}
else{
echo "no";
}
?>
</div>
<div class="display">
<h1 style="color:blue;text-align:center">Unfinished Tasks</h1>
<?php
$server = "localhost";
$user = "root";
$password = "ag97";
$db = "note";
$conn = new mysqli($server,$user,$password,$db);
$query = "SELECT * FROM note WHERE status='not completed' ORDER BY end DESC";
if($result = $conn->query($query)){
while($row = $result->fetch_assoc()){
?>
<form method="post" action="edit.php">
<input type="text" name="id" value=" <?php echo $row['id'];?> " hidden>
<p>Heading:</p>
<input type="text" name="heading" value=" <?php echo $row['heading'];?> "><br><br>
<p>Due-date:</p>
<input type="date" name="end" value="<?php echo date('Y-m-d',strtotime($row['end'])) ?>"><br><br>
<?php
if($row['status'] == "completed" ){
echo "<p>Status: <input type='radio' name='status' value='completed' checked> Completed
<input type='radio' name='status' value='not completed' > Not completed</p><br><br>";
}
else
{
echo "<p>Status: <input type='radio' name='status' value='completed' > Completed
<input type='radio' name='status' value='not completed' checked> Not completed</p><br><br>";
}
?>
<p>Content:</p>
<input type="text" name="content" value=" <?php echo $row['content'];?> "><br><br>
<input type="submit" name="changes" value="Save changes"> <input type="submit" name="delete" value="Delete">
</form><br><br><hr><br>
<?php
}
}
else{
echo "no";
}
?>
</div>
</body>
</html>