-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminfopro.php
More file actions
48 lines (40 loc) · 1.36 KB
/
minfopro.php
File metadata and controls
48 lines (40 loc) · 1.36 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
<?php
session_start();
require_once('dbcon.php');
$namapel=$_POST['NamaPel'];
$tel=$_POST['tele'];
$jln=$_POST['alamat'];
$bdr=$_POST['bdr'];
$pkod=$_POST['poskod'];
$negeri=$_POST['ngr'];
$queryj="INSERT INTO alamat(alamat,bandar,poskod,negeri)
VALUES ('$jln','$bdr','$pkod','$negeri')";
$resultj=mysqli_query($con,$queryj);
$get="SELECT idAlamat FROM alamat WHERE
alamat='$jln' AND poskod='$pkod'";
$resultget=mysqli_query($con,$get);
$row= mysqli_fetch_assoc($resultget);
$ida= implode("",$row);
$queryk="INSERT INTO pelanggan(namaPelanggan,nomHP,idAlamat)
VALUES ('$namapel','$tel','$ida')";
$resultk=mysqli_query($con,$queryk);
{if($resultj && $resultk){
echo "<script>window.alert('Pelanggan Berjaya Didaftarkan!');</script>";
{if ($_SESSION['user'] == "pekerja") {
echo "<script> window.location='./pekerja/home.php'</script>";
} elseif($_SESSION['user'] == "admin") {
echo "<script> window.location='./admin/ahome.php'</script>";
}
}
}
else{
mysqli_query($con,"DELETE FROM alamat WHERE idAlamat='$ida'");
echo "<script>window.alert('Pelanggan Gagal Didaftarkan!');</script>";
{if ($_SESSION['user'] == "pekerja") {
echo "<script> window.location='./pekerja/masukinfo.php'</script>";
} elseif($_SESSION['user'] == "admin") {
echo "<script> window.location='./admin/amasukinfo.php'</script>";
}
}
}}
?>