-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprosesconfirmation.php
39 lines (32 loc) · 1.15 KB
/
prosesconfirmation.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
<?php
session_start();
include("configuration.php");
if(isset($_POST["submit"]))
{
//pengambilan tabel produk
$item = $_POST['namaproduk'];
$result = mysqli_query($con, "SELECT * FROM produk WHERE namaproduk = '$item'");
$baris = mysqli_fetch_assoc($result);
$idprodak = $baris['Productid'];
//ambiltabel
$nama=$_POST['Namalengkap'];
$alamat=$_POST['alamat'];
$postal=$_POST['postalcode'];
$notel=$_POST['phonenumber'];
$kuantiti=$_POST['quantity'];
$kurir=$_POST["courier"];
$iduser = $_SESSION["id_user"];
//operasi
mysqli_query($con, "INSERT INTO confirmation VALUES ('','$nama', '$alamat', '$postal', '$notel', '$kuantiti', '$kurir','$iduser','$idprodak','$item')");
$iduser = $_SESSION["id_user"];
$res = mysqli_query($con, "SELECT * FROM confirmation WHERE iduser = '$iduser'");
$baris1 = mysqli_fetch_assoc($res);
$_POST['confirmationid'] = $baris1['confirmationid'];
$confirmationid = $_POST['confirmationid'];
mysqli_query($con, "INSERT INTO cart VALUES ('','$confirmationid')");
header("Location: cart.php");
}
else{
echo"terdapat kesalahan";
}
?>