-
Notifications
You must be signed in to change notification settings - Fork 0
/
daftar.php
executable file
·97 lines (94 loc) · 3.12 KB
/
daftar.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
<?php
include 'admin/koneksi.php';
?>
<!DOCTYPE html>
<html>
<head>
<title>tuKol</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<!-- VENDOR CSS -->
<link rel="stylesheet" href="admin/assets/vendor/bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="admin/assets/vendor/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="admin/assets/vendor/linearicons/style.css">
</head>
<body>
<?php
include 'menu.php';
?>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">Daftar Pelanggan</h2>
</div>
<div class="panel-body">
<form method="post">
<div class="form-group">
<label class="control-label col-md-3">Nama</label>
<div class="col-md-7">
<input type="text" name="nama" class="form-control" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Email</label>
<div class="col-md-7">
<input type="text" name="email" class="form-control" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Password</label>
<div class="col-md-7">
<input type="password" name="password" class="form-control" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Alamat</label>
<div class="col-md-7">
<textarea name="alamat" class="form-control" required></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Telp / HP</label>
<div class="col-md-7">
<input type="text" name="telepon" class="form-control" required>
</div>
</div>
<div class="form-group">
<div class="col-md-7">
<button name="daftar" class="btn btn-primary">Daftar</button>
</div>
</div>
</form>
<?php
if (isset($_POST["daftar"])) {
$nama=$_POST['nama'];
$email=$_POST['email'];
$password=$_POST['password'];
$alamat=$_POST['alamat'];
$telepon=$_POST['telepon'];
$ambil=$koneksi->query("SELECT*FROM tb_pelanggan WHERE email_pelanggan='$email' ") or die(mysqli_error($koneksi));
$yangcocok=$ambil->num_rows;
if ($yangcocok==1) {
echo "<script>
alert('Email sudah terdaftar');
location='daftar.php';
</script>";
}else{
$koneksi->query("INSERT INTO tb_pelanggan (nama_pelanggan,email_pelanggan,password_pelanggan,alamat_pelanggan,telepon_pelanggan) VALUES('$nama','$email','$password','$alamat','$telepon')") or die(mysqli_error($koneksi));
echo "<script>
alert('Pendaftaran berhasil');
location='login.php'
</script>";
}
}
?>
</div>
</div>
</div>
</div>
</div>
</body>
</html>