-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwords.php
123 lines (112 loc) · 4.55 KB
/
words.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
<?php
session_start();
require_once "functions.php";
$_user_id = $_SESSION['id']??0;
if(!$_user_id){
header('Location: index.php');
die();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Todo/Tasks</title>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic">
<link rel="stylesheet" href="//cdn.rawgit.com/necolas/normalize.css/master/normalize.css">
<link rel="stylesheet" href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body class="voc">
<div class="sidebar">
<h4>Menu</h4>
<ul class="menu">
<li><a href="words.php" class="menu-item" data-target="words">All Words</a></li>
<li><a href="#" class="menu-item" data-target="wordform">Add New Word</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
</div>
<div class="container" id="main">
<h1 class="maintitle">
<i class="fas fa-language"></i> <br/>My Vocabularies
</h1>
<div class="wordsc helement" id="words">
<div class="row">
<!-- <div class="column column-50">
<div class="alphabets">
<select id="alphabets">
<option value="all">All Words</option>
<option value="A">A#</option>
<option value="B">B#</option>
<option value="C">C#</option>
<option value="D">D#</option>
<option value="N">N#</option>
<option value="M">M#</option>
</select>
</div>
</div> -->
<div class="column column-50">
<form action="" method="POST">
<button class="float-right" name="submit" value="submit">Search</button>
<input type="text" name="search" class="float-right" style="width: 50%; margin-right:20px;" placeholder="Search">
</form>
</div>
</div>
<hr>
<table class="words" >
<thead>
<tr>
<th width="20%">Word</th>
<th>Definition</th>
</tr>
</thead>
<tbody>
<?php
// if(isset($_POST['submit'])){
// $serachedText = $_POST['search'];
// $words = getWords($_user_id, $serachedText);
// }else{
// $words = getWords($_user_id);
// }
if(isset($_POST['submit'])){
$serachedText = $_POST['search'];;
$words=getWords($_user_id,$serachedText);
}
else{
$words=getWords($_user_id);
}
if(count($words)>0) {
$length = count($words);
for ( $i = 0; $i < $length; $i ++ ) {
?>
<tr>
<td><?php echo $words[$i]['word']; ?></td>
<td><?php echo $words[$i]['meaning']; ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<div class="formc helement" id="wordform" style="display: none;">
<form action="tasks.php" method="post">
<h4>Add New Word</h4>
<fieldset>
<label for="word">Word</label>
<input type="text" name="word" placeholder="Word" id="word">
<label for="Meaning">Meaning</label>
<textarea name="meaning" placeholder="Meaning" id="Meaning" style="height:100px" rows="10"></textarea>
<input type="hidden" name="action" value="addword">
<input class="button-primary" type="submit" value="Add Word">
</fieldset>
</form>
</div>
</div>
</body>
<script src="//code.jquery.com/jquery-3.4.1.slim.min.js"></script>
<script src="assets/js/script.js?1"></script>
</html>