-
Notifications
You must be signed in to change notification settings - Fork 0
/
taabel.php
82 lines (63 loc) · 2.67 KB
/
taabel.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
<?php
//taabel.php
require_once("funktsioon6t.php");
require_once("edit_function7t.php");
//kasutaja tahab midagi muuta
if(isset($_POST["update"])){
updateClothes($_POST["id"], $_POST["user_id"], $_POST["clothes"], $_POST["brand"], $_POST["size"], $_POST["color"]);
}
//kasutaja tahab midagi kustutada
if(isset($_GET["delete"])){
//saadan kaasa id, mida kustutada
function deleteClothes(){
}
deleteClothes($_GET["delete"]);
}
$clothes_list=getClothes();
?>
<table border=1>
<tr>
<th>id</th>
<th>kasutaja id</th>
<th>Clothes</th>
<th>Brand</th>
<th>Size</th>
<th>Color</th>
<th>X</th>
<?php
//iga massiivis olema elemendi kohta
//count($clothes_list) - massiiivi pikkus
for($i = 0; $i < count($clothes_list); $i++){
if (isset($_GET["edit"]) && $clothes_list[$i]->id == $_GET["edit"]){
//kasutajale muutmiseks
echo"<tr>";
echo "<form action='taabel.php' method='post'>";
echo"<form>";
echo "<td>". $clothes_list[$i]->id."</td>";
echo "<td>". $clothes_list[$i]->user_id."</td>";
echo "<td><input name='id' value='" . $clothes_list[$i]->id."'></td>";
echo "<td><input name='user_id' value='" . $clothes_list[$i]->user_id."'></td>";
echo "<td><input name='clothes' value='" . $clothes_list[$i]->clothes."'></td>";
echo "<td><input name='brand' value='" . $clothes_list[$i]->brand."'></td>";
echo "<td><input name='size' value='" . $clothes_list[$i]->size."'></td>";
echo "<td><input name='color' value='" . $clothes_list[$i]->color."'></td>";
echo "<td><input type='submit', name='update'></td>";
echo "<td><a href='taabel.php'>cancel</a></td>";
echo"</form>";
echo"<tr>Seda rida muudetakse</tr>";
echo"</tr>";
}else{
echo"<tr>";
echo "<td>". $clothes_list[$i]->id."</td>";
echo "<td>". $clothes_list[$i]->user_id."</td>";
echo "<td>". $clothes_list[$i]->clothes."</td>";
echo "<td>". $clothes_list[$i]->brand."</td>";
echo "<td>". $clothes_list[$i]->size."</td>";
echo "<td>". $clothes_list[$i]->color."</td>";
echo "<td><a href='?delete=". $clothes_list[$i]->id."'>X</a></td>";
echo "<td><a href='?edit=". $clothes_list[$i]->id."'>edit</a></td>";
echo"</tr>";
}
}
?>
</table>