-
Notifications
You must be signed in to change notification settings - Fork 1
/
todo.php
176 lines (152 loc) · 3.22 KB
/
todo.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
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<html>
<head>
<style type="text/css">
body{
margin: 0;
width: 100vw;
height: 100vh;
overflow: hidden;
}
header{
width:100vw;
height:7vh;
color:red;
border-bottom: 1px solid black;
}
.but{
border-radius: 100%;
border:1px solid black;
}
.but:hover{
cursor: pointer;
}
#todo{
width:50vw;
height: 90vh;
}
#list{
width: 49vw;
height: 90vh;
position: absolute;
}
#list_inner{
position: relative;
margin-top: 5vh;
margin-left: 3vw;
}
main div{
display: inline-block;
}
.add_bttn{
border-radius: 100%;
border:0;
height:7vh;
width:7vh;
}
.add_bttn:hover{
background-color: red;
}
</style>
</head>
<body>
<script>
function add()
{
var add_menu=document.getElementById('add_menu');
add_menu.style.display="block";
}
function show_list()
{
var list_text=document.getElementById('list_text');
list_text.style.display="block";
}
function hide_list()
{
var list_text=document.getElementById('list_text');
list_text.style.display="none";
}
</script>
<header>
<center><h1>TODO</h1></center>
</header>
<main>
<div id="todo">
<?php
$con=mysqli_connect("localhost","root","","customized");
$query="select * from ToDo";
$res=mysqli_query($con,$query);
$list=array();
$i=0;
$list_arr=array();
while($result=mysqli_fetch_array($res))
{
echo '<form name="todos" method="post">';
if($result['todo_type']=="list")
{
echo '<input type="checkbox" name="cb[]" value="'.$result['sno'].'">'.$result['todo_title']." ".'<input type="submit" value="Expand" class="expand" name="'.$result['sno'].'">'.'<br>'.'<br>';
$list[$i]=$result['sno'];
$list_arr[$i]=$result['todo_task'];
$i=$i+1;
}
else if($result['todo_type']=="short")
{
echo '<input type="checkbox" name="cb[]" >'.$result['todo_title'].'<br>'.'<br>';
}
}
echo '<input type="submit" name="submit" value="delete">';
echo '</form>';
if(isset($_POST['submit']))
{
$name=$_POST['cb'];
foreach($name as $n)
{
echo $n;
}
}
// *************************TO ADD A TODO *************************************php
?>
<br>
<button onclick="add()" class="add_bttn">+</button>
<br>
<form name="todos" method="post">
<div id="add_menu" style="display: none;"><input type="text" placeholder="Enter todo_title" name="todo_title">
<select id="select_dropdown" name="select_type"><option value="short" onclick="hide_list()">Short</option>
<option value="list" onclick="show_list()">List</option>
</select>
<div id="list_text" style="display: none;">
<textarea name="list_text" form="todos" placeholder="TYPE LIST SEPERATED BY , "></textarea>
</div>
<input type="submit" name="submit_menu" value="Done">
</div>
</form>
</div>
CREATE PHP CODE HERE IN THE NEXT WORK SESSION MR KAPIL ......... USE THE FORM ABOVE TO INPUT INTO TABLE
<div id="list">
<center>YOUR LISTS</center>
<div id="list_inner">
<?php
for($k=0;$k<$i;$k++)
{
if(isset($_POST[$list[$k]]))
{
$str=$list_arr[$k];
$temp=2;
echo "1) ";
for($m=0;$m<strlen($str);$m++)
{
if($str[$m]!=",")
echo $str[$m];
else if($str[$m]==",")
{
echo '<br>'.$temp.") ";
$temp=$temp+1;
}
}
}
}
?>
</div>
</div>
</main>
</body>
</html>