-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit.php
64 lines (61 loc) · 2.95 KB
/
edit.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
<html>
<head>
<title>ToDoList - Изменить</title>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo="
crossorigin="anonymous"></script>
<link rel="stylesheet" href="css/index.css">
<link rel="icon" href="https://img.icons8.com/external-vectorslab-glyph-vectorslab/53/C850F2/external-Checklist-shopping-and-commerce-vectorslab-glyph-vectorslab.png">
</head>
<body>
<div class="container">
<?php include "templates/header.php"?>
<h1>Изменить задачу</h1>
<?php
require_once 'db.php';
$task = get_task($_GET["id"]);
?>
<form class="form" method="post" id="form">
<input type="hidden" name="id" value="<?= $task["id"] ?>">
<div class="form-group">
<label class="task-label" for="name">Название</label>
<input type="text" name="name" value="<?= $task["name"] ?>" required>
</div>
<div class="form-group">
<label class="task-label" for="description">Описание</label>
<textarea name="description" cols="30" rows="5"><?= $task["description"] ?></textarea>
</div>
<div class="form-group">
<label class="task-label" for="end_date">Дедлайн</label>
<input class="task-end-date" type="datetime-local" name="end_date" value="<?= $task["end_date"] ?>">
</div>
<div class="form-group">
<label class="task-label" for="priority">Приоритет</label>
<select name="priority" required>
<?php
$optionArr = [
1 => "Очень важно",
2 => "Важно",
3 => "Важно но не срочно",
4 => "Не важно",
];
for ($i = 1; $i < 5; $i++) {
if ($i == $task["priority"]){ ?>
<option value="<?= $i ?>" selected><?= $optionArr[$i]; ?></option>
<?php
}
else
{ ?>
<option value="<?= $i ?>"><?= $optionArr[$i]; ?></option>
<?php
}
}
?>
</select>
</div>
<button class="btn">Изменить</button>
</form>
<script src="js/edit.js"></script>
</div>
</body>
</html>