-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathedit-rangking.php
More file actions
78 lines (72 loc) · 2.29 KB
/
edit-rangking.php
File metadata and controls
78 lines (72 loc) · 2.29 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
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
<?php
include "header.php";
include "includes/config.php";
//code edit data
$ia = isset($_GET['ia']) ? $_GET['ia'] : die('ERROR: missing ID.');
$ik = isset($_GET['ik']) ? $_GET['ik'] : die('ERROR: missing ID.');
$readOne= mysqli_query($koneksi,"SELECT * FROM rangking WHERE id_alternatif='$ia' AND id_kriteria='$ik' LIMIT 0,1");
$getRow = mysqli_fetch_assoc($readOne);
$readkr = mysqli_query($koneksi,"SELECT * FROM kriteria WHERE id_kriteria='$ik'");
$getRowkr = mysqli_fetch_assoc($readkr);
$readalt = mysqli_query($koneksi,"SELECT * FROM alternatif WHERE id_alternatif='$ia'");
$getRowalt = mysqli_fetch_assoc($readalt);
$readna = mysqli_query($koneksi,"SELECT * FROM nilai_alternatif ORDER BY id_nilai_alternatif ASC");
//code update data
if ($_POST) {
$nn = $_POST['nn'];
$update = mysqli_query($koneksi,"UPDATE rangking
SET nilai_rangking = '$nn'
WHERE id_alternatif = '$ia'
AND id_kriteria = '$ik'");
if ($update) {
echo "<script>location.href='rangking.php'</script>";
}else {
echo "Gagal";
}
}
?>
<br>
<div class="container">
<div class="row">
<div class="col-md-6 text-left">
<h4>Form Ubah Rangking</h4>
</div>
<div class="col-md-6">
</div>
</div>
<br><br>
<form method="POST" action="">
<div class="form-group">
<label for="alt">Alternatif</label>
<div>
<input type="text" class="form-control" id="alt" name="alt" value="<?php echo $getRowalt['nama_alternatif'] ?>" disabled>
</div>
</div>
<div class="form-group">
<label for="kr">Kriteria</label>
<div>
<input type="text" class="form-control" id="kr" name="kr" value="<?php echo $getRowkr['nama_kriteria'] ?>" disabled>
</div>
</div>
<div class="form-group">
<label for="nn">Nilai</label>
<div>
<select class="form-control" id="nn" name="nn">
<option><?php echo $getRow['nilai_rangking']; ?></option>
<?php
while ($row = mysqli_fetch_assoc($readna)){
extract($row);
echo "<option value='{$jum_nilai_alternatif}'>{$ket_nilai_alternatif}</option>";
}
?>
</select>
</div>
</div>
<div class="form-group">
<div>
<button type="submit" class="btn btn-primary">Ubah</button>
<button type="button" onclick="location.href='rangking.php'" class="btn btn-success">Kembali</button>
</div>
</div>
</form>
</div>