-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-apoteker.php
113 lines (100 loc) · 3.46 KB
/
update-apoteker.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
<?php
session_start();
if(empty($_SESSION['username'])){
header('location:login.php');
}elseif($_SESSION['level']!=1){
header('location:index-p.php');
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="./css/data-p_add_style.css">
<title>SMKlinik | Edit Apoteker</title>
</head>
<body>
<header>
<div class="container">
<div id="logo">
<img src="./img/ini_logo.png" alt="Logo">
<a href="index-a.php"><span class="hightlight">Klinik</span> Cahaya</a>
</div>
<div id="profil">
<img src="./img/pp.png" alt="Profil">
<h4>ADMIN</h4>
</div>
</div>
</header>
<section id="add-data">
<div class="container">
<div class="title">
<h2>Edit Data</h2>
</div>
<div class="report">
<?php
include 'connect.php';
$id = $_GET['id'];
$sql = mysqli_query($connect,"SELECT * FROM tb_apoteker WHERE id_apoteker = '$id' ");
$data = mysqli_fetch_array($sql);
?>
<form class="add" action="" method="post">
<table>
<tr><td><input type="text" name="id" value="<?php echo $data['id_apoteker'] ?>" hidden=hidden></td></tr>
<tr>
<td>ID Apoteker</td>
<td><input type="text" name="id" value="<?php echo $data['id_apoteker'] ?>" disabled=disabled></td>
</tr>
<tr>
<td>Nama</td>
<td><input type="text" name="nama" value="<?php echo $data['nama'] ?>"></td>
</tr>
<tr>
<td>Jenis Kelamin</td>
<td>
<select class="jk" name="jenisk">
<option <?php if($data['jenis_kelamin']=="Laki-Laki") echo "selected" ?> value="Laki-Laki">Laki-Laki</option>
<option <?php if($data['jenis_kelamin']=="Perempuan") echo "selected" ?> value="Perempuan">Perempuan</option>
</select>
</td>
</tr>
<tr>
<td>No. Telepon</td>
<td><input type="text" name="telp" value="<?php echo $data['telp'] ?>"></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="email" value="<?php echo $data['email'] ?>"></td>
</tr>
<tr>
<td>Alamat</td>
<td><input type="text" style="height:40px" name="alamat" value="<?php echo $data['alamat'] ?>"></td>
</tr>
</table>
<div class="button">
<input type="submit" name="upbutton" value="Edit">
<a href="data_apoteker-a.php"><button type="button" name="back">Kembali</button></a>
</div>
</form>
<?php
if(isset($_POST['upbutton'])){
include('connect.php');
$nama = $_POST['nama'];
$email = $_POST['email'];
$telp = $_POST['telp'];
$alamat = $_POST['alamat'];
$jenis_kelamin = $_POST['jenisk'];
mysqli_query($connect,"UPDATE tb_apoteker SET nama = '$nama', jenis_kelamin='$jenis_kelamin', email='$email', telp='$telp', alamat='$alamat' WHERE id_apoteker = '$id'");
header('location:data_apoteker-a.php');
}
?>
</div>
</div>
</section>
<footer>
<div class="container">
<p>Klinik Cahaya || Copyright © 2019</p>
</div>
</footer>
</body>
</html>