-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathproductFunction.php
More file actions
34 lines (28 loc) · 918 Bytes
/
Copy pathproductFunction.php
File metadata and controls
34 lines (28 loc) · 918 Bytes
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
<?php
include "connect.php";
session_start();
$nominal = $_POST["nominal"];
$idPenawar = $_SESSION["id"];
$idBisnis = $_GET["id"];
$sqlBis = "SELECT id, nama, harga FROM bisnis WHERE id=$idBisnis";
$hasil = mysqli_query($conn, $sqlBis);
$row = mysqli_fetch_assoc($hasil);
$idBis = $row['id'];
$namaBisnis = $row['nama'];
$hargaBis = $row['harga'];
$var = "INSERT INTO penawaran (id_bisnis, id_penawar, namaBisnis, hargaAsli, hargaTawar, tanggal) VALUES ('$idBisnis','$idPenawar','$namaBisnis','$hargaBis', '$nominal', NOW())";
if(isset($_POST['submit'])){
$hasil = $conn->query($var);
if ($hasil === TRUE) {
header("Location: product.php?id=$idBisnis");
} else {
echo "
<script>
alert('Mohon maaf gagal mengajukan penawaran!');
window.location=document.referrer;
</script>
";
}
}
$conn->close();
?>