-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit.php
81 lines (70 loc) · 1.83 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
require('database.php');
$id = $_REQUEST['id'];
$select = "Select * from user where id = '".$id."'";
$query = mysqli_query($connect, $select);
$row = mysqli_fetch_assoc($query);
?>
<html>
<head>
</head>
<?php
if(isset($_POST['send']))
{
$nama = $_POST['nama'];
$des = $_POST['des'];
$dateUpdated = date("Y-m-d H:i:s");
$update = "update `user` set nama='".$nama."', des='".$des."', date2='".$dateUpdated."' where id = '".$id."' ";
$test = mysqli_query($connect,$update);
if($test){
?>
<script>
alert('success');
window.location.href="show.php";
</script>
<?php
} else {
?>
<script>
alert('error');
</script>
<?php }
};
?>
<body>
<style>
.box {border: black solid;
height:500px;
width:600px;}
</style>
<table>
<tr>
<td width="50%"></td>
<td class="box" align="center">
<table>
<tr>
<th><h1>Edit Detail</h1></th>
</tr>
<form action="" name"form" method="post">
<tr>
<td><input type="hidden" name="id" value="<?php echo $row['id']; ?>" /></td>
</tr>
<tr>
<td>Name: <input name="nama" type="text" value="<?php echo $row['nama']; ?>" placeholder="Insert Name" /><br/><br/></td>
</tr>
<tr>
<td>Description: <input name="des" type="text" value="<?php echo $row['des']; ?>" placeholder="Insert Description" /><br/><br/></td>
</tr>
<tr>
<td align="right"><a href="show.php">
<input name="view" type="button" value="Back" /></a>
<input name="send" type="submit" value="Update" /><br/><br/> </td>
</form>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>