forked from anirban0328/Restaurant-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patholdinventory.php
94 lines (88 loc) · 1.81 KB
/
oldinventory.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
<?php
session_start();
if(!isset($_SESSION[username]))
{
header("Location:index.php");
exit;
}
include("header.php");
include("sql.php");
?>
<html>
<head>
<title>EXISTING INVENTORIES</title>
<link href="stylesheets/main.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>EXISTING INVENTORIES </h1>
<?php
if(isset($_POST[type]))
{
echo '
<div align="center">
<form action="oldinventory.php" method="post">
SELECT INVENTORY:
<select name="name">';
$q="SELECT item_name FROM inventories WHERE item_type='".$_POST[type]."';";
$res=mysql_query($q,$con) OR die('Error in selecting: ' . mysql_error());
while($arr=mysql_fetch_array($res))
{
echo '<option value="'.$arr[0].'">'.$arr[0].'</option>';
}
echo '
</select>
<input type="submit" value="GET INFORMATION"/>
</form>
</div>';
}
else if(isset($_POST[name]))
{
echo '<div align="center">';
$q="SELECT * FROM inventories WHERE item_name='".$_POST[name]."';";
$res=mysql_query($q,$con) OR die('Error in selecting: ' . mysql_error());
while($arr=mysql_fetch_array($res))
{
echo "
<table>
<tr>
<td>INVENTORY ID : </td>
<td> $arr[0] </td>
</tr>
<tr>
<td>INVENTORY NAME : </td>
<td> $arr[1] </td>
</tr>
<tr>
<td>QUANTITY: </td>
<td> $arr[2] </td>
</tr>
<tr>
<td>INVENTORY TYPE : </td>
<td> $arr[3] </td>
</tr>
</table>";
}
}
else
{
echo '
<div align="center">
<form action="oldinventory.php" method="post" >
SELECT INVENTORY TYPE:
<select name="type">';
$q="SELECT DISTINCT item_type FROM inventories";
$res=mysql_query($q,$con) OR die("Error in selecting: " . mysql_error());
while($arr=mysql_fetch_array($res))
{
echo '<option value="'.$arr[0].'">'.$arr[0].'</option>';
}
echo '
</select>
<input type="submit" value="GET INFORMATION"/>
</form>
</div>';
}
?>
<?php mysql_close($con);?>
</body>
</html>