-
Notifications
You must be signed in to change notification settings - Fork 1
/
called.php
40 lines (39 loc) · 865 Bytes
/
called.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
<?php
session_start();
include 'assets/bill.php';
include 'assets/db.php';
if (isset($_REQUEST['q']))
{
if ($_REQUEST['q'] == 'addtobill')
{
$id = $_REQUEST['id'];
$array = $con->query("select * from inventeries where id = '$id'");
$row = $array->fetch_assoc();
$name = $row['name'];
$price = $row['price'];
$qty = '1';
$item = array(
'id' => $id,
'name' => $name,
'price' => $price,
'qty' => $qty
);
array_push($_SESSION['bill'],$item);
}
}
if (isset($_GET['remove']))
{
$id = $_GET['remove'];
foreach ($_SESSION['bill'] as $key => $value)
{
if($_SESSION['bill'][$key]['id'] == $id){
unset($_SESSION['bill'][$key]);
break;
}
}
header("location:billing.php");
}
echo $_SESSION['bill'][2]['id'];
echo "<pre>";
print_r($_SESSION['bill']);
?>