-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathedit.php
More file actions
73 lines (62 loc) · 2 KB
/
edit.php
File metadata and controls
73 lines (62 loc) · 2 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
<html>
<head>
<!--
Project Name : CRUD with PHP, MySQL and Bootstrap
Author : Hendra Setiawan
Website : http://www.hendrasetiawan.net
Email : hendrabpp[at]gmail.com
-->
<?php
include "module/header.php";
include "module/alerts.php";
include "config/connect.php";
$sql = mysql_query("SELECT id, nama, email, hp FROM t_member WHERE id = '".$_GET['id']."'");
$data = mysql_fetch_array($sql);
?>
</head>
<body>
<div class="container">
<?php include "module/nav.php"; ?>
<div class="row">
<div class="col-lg-12">
<div class="page-header">
<h1>Form Edit (Update)</h1>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<form id="form_input" method="POST">
<?php
if(isset($_POST['update']))
{
mysql_query("UPDATE t_member SET nama = '".$_POST['nama']."', email = '".$_POST['email']."', hp = '".$_POST['hp']."' WHERE id = '".$_GET['id']."'");
writeMsg('update.sukses');
//Re-Load Data from DB
$sql = mysql_query("SELECT id, nama, email, hp FROM t_member WHERE id = '".$_GET['id']."'");
$data = mysql_fetch_array($sql);
}
?>
<div class="form-group">
<label class="control-label" for="nama">Nama (wajib diisi)</label>
<input type="text" class="form-control" name="nama" id="nama" value="<?php echo $data['nama']; ?>" required>
</div>
<div class="form-group">
<label class="control-label" for="email">Email (wajib diisi)</label>
<input type="email" class="form-control" name="email" id="email" value="<?php echo $data['email']; ?>" required>
</div>
<div class="form-group">
<label class="control-label" for="hp">No HP</label>
<input type="text" class="form-control" name="hp" id="hp" value="<?php echo $data['hp']; ?>">
</div>
<div class="form-group">
<input type="submit" value="Update" name="update" class="btn btn-primary">
<a href="rekap.php" class="btn btn-danger">Batal</a>
</div>
</form>
</div>
</div>
</div>
<?php include "module/footer.php"; ?>
</body>
</html>