-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtambah.php
70 lines (62 loc) · 1.24 KB
/
tambah.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
<?php
session_start();
if(!isset($_SESSION["login"])){
header("Location: login.php");
exit;
}
require 'functions.php';
//cek apakah tombol submit telah ditekan
if(isset($_POST["submit"])){
//cek keberhasilan
if(tambah($_POST) > 0){
echo "
<script>
alert('Data Berhasil Ditambahkan!');
document.location.href = 'index.php';
</script>
";
} else {
echo "
<script>
alert('Data Gagal Ditambahkan!');
document.location.href = 'index.php';
</script>
";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Tambah Data User</title>
</head>
<body>
<h1>Tambah Data User</h1>
<form action="" method="post" enctype="multipart/form-data">
<ul>
<li>
<label for="username">Username :</label>
<input type="text" name="username" id="username"
required>
</li>
<li>
<label for="email">Email :</label>
<input type="text" name="email" id="email"
required>
</li>
<li>
<label for="password">Password :</label>
<input type="password" name="password" id="password"
required>
</li>
<li>
<label for="gambar">Gambar :</label>
<input type="file" name="gambar" id="gambar">
</li>
<li>
<button type="submit" name="submit">Tambah Data</button>
</li>
</ul>
</form>
</body>
</html>