-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewproducts.php
125 lines (121 loc) · 3.73 KB
/
viewproducts.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
session_start();
include("includes/header.php");
include("includes/conn.php");
mysqli_query($con,"DELETE FROM products WHERE prod_id=$_GET[delid]");
$resbranch = mysqli_query($con,"select * from branch");
?>
<div id="templatemo_main">
<div id="sidebar" class="float_l">
<div class="sidebar_box"><span class="bottom"></span>
<?php
include("sidebar.php");
adminhome();
?>
</div>
</div>
<div id="content" class="float_r">
<h1>View Products</h1>
<p><a href="addproduct.php">Add produts</a></p>
<script type="application/javascript" >
function validation()
{
if(document.adprod.ptype.value == "")
{
alert("Product Type Should be selected.");
return false;
}
if(document.adprod.ptype2.value == "")
{
alert("Sub Type Should be selected.");
return false;
}
if(document.adprod.name.value == "")
{
alert("Select Product Name.");
document.adprod.name.focus();
return false;
}
if(document.adprod.cost.value == "")
{
alert("Enter The Cost.");
document.adprod.cost.focus();
return false;
}
if(document.adprod.bname.value == "")
{
alert("Select Branch.");
return false;
}
if(document.adprod.qty.value == "")
{
alert("Enter The Quantity.");
document.adprod.qty.focus();
return false;
}
if(document.adprod.file.value == "")
{
alert("Select The Image.");
document.adprod.file.focus();
return false;
}
}
</script>
<form action="" method="post" enctype="multipart/form-data" name="adprod" id="adprod" onsubmit="return validation()">
<table width="681" border="1">
<tr bgcolor="#CCCCCC">
<td width="108"><strong>Image</strong></td>
<td width="210"><strong>Product info</strong></td>
<td width="106"><strong>Cost</strong></td>
<td width="66"><strong>Quantity</strong></td>
<td width="96"><strong>Branch Name</strong></td>
<td width="55"><strong>Action</strong></td>
</tr>
<?php
$resultquery = mysqli_query($con,"SELECT * FROM products");
while($rowrec = mysqli_fetch_array($resultquery))
{
?>
<tr>
<td> <img src="upload/<?php echo $rowrec[image]; ?>" width="100" height="100" /></td>
<td> <strong>Product name: </strong><?php echo $rowrec[name]; ?><br />
<strong>Product type:</strong> <?php echo $rowrec[product_type]; ?><br />
<strong>Sub type:</strong> <?php echo $rowrec[sub_type]; ?><br /><table width="174" border="0">
<tr>
<td width="37"><strong>Color</strong> : </td>
<td width="68" bgcolor="<?php echo $rowrec[color]; ?>"> </td>
</tr>
</table>
<br />
</td>
<td> Rs. <?php echo $rowrec[cost]; ?></td>
<td> <?php echo $rowrec[quantity]; ?></td>
<td>
<?php
$resultquery1 = mysqli_query($con,"SELECT * FROM branch where branch_id=$rowrec[branch_id]");
$rowrec1 = mysqli_fetch_array($resultquery1);
echo $rowrec1[branch_name];
?>
</td>
<td align="center" > <?php echo
"<a href=addproduct.php?prodid=$rowrec[prod_id]>Edit</a> <hr>
<a href=viewproducts.php?delid=$rowrec[prod_id]>Delete</a>"; ?></td>
</tr>
<?php
}
?>
</table>
</form>
<div id="content_main"><form id="form1" name="form1" method="post" action="">
<p>
<center>
</center>
</p>
</form>
</div>
</div>
<div class="cleaner"></div>
</div>
<?php
include("includes/footer.php");
?>