-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit.php
More file actions
47 lines (44 loc) · 1.76 KB
/
edit.php
File metadata and controls
47 lines (44 loc) · 1.76 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
<html>
<body>
<form action = 'edit.php' method = 'get'>
<table>
<tr><th><i>Значение:</i></th></tr>
<tr><td><b>id_worker:</b></td><td><input name = 'id' type = 'hidden' value='<?=$_GET['id_worker']?>'></td></tr>
<tr><td><b>ФИО_Соискателя:</b></td><td><input name = 'form_1' type = 'text' value='<?=$_GET['form_1']?>'></td></tr>
<tr><td><b>Компетенция:</b></td><td><input name = 'form_2' type = 'text' value='<?=$_GET['form_2']?>'></td></tr>
<tr><td><b>Название_разряда:</b></td><td><input name = 'form_3' type = 'text' value='<?=$_GET['form_3']?>'></td></tr>
</table>
<br/>
<input type = 'submit' name = 'button'>
</form>
</body>
</html>
<?php
include 'connecting.php';
$form_1 = strtr(trim(@$_GET['form_1']), '*', '%');
$form_2 = strtr(trim(@$_GET['form_2']), '*', '%');
$form_3 = strtr(trim(@$_GET['form_3']), '*', '%');
$id_worker = strtr(trim(@$_GET['id']), '*', '%');
if(isset($_GET['button']))
{
if (!empty($form_1)){
$query = "UPDATE Worker
SET Worker.full_name ='$form_1'
WHERE Worker.id_worker ='$id_worker';";
$result = mysqli_query($link, $query) or die("form_1: ".mysqli_error($query));
}
if (!empty($form_2)){
$query = "UPDATE Education
SET Education.competence ='$form_2'
where Education.id_education = (select Worker.id_education from Worker WHERE Worker.id_worker ='$id_worker');";
$result = mysqli_query($link, $query) or die("form_2: ".mysqli_error($query));
}
if (!empty($form_3)){
$query = "UPDATE Courses
SET Courses.name ='$form_3'
where Courses.level = (select Worker.level from Worker WHERE Worker.id_worker ='$id_worker');";
$result = mysqli_query($link, $query) or die("form_3: ".mysqli_error($query));
}
header('location: ./list.php');
}
?>