-
Notifications
You must be signed in to change notification settings - Fork 0
/
product_new.php
134 lines (119 loc) · 6.32 KB
/
product_new.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
126
127
128
129
130
131
132
133
134
<?php
if(!isset($_SESSION))
{
session_start();
}
if(!isset($_SESSION['UserLogin']) || $_SESSION['UserLogin']['Role']!='admin')
{
header('location:index.php');return;
}
$_SESSION['page']='newProduct';
include('header.php');
?>
<div class="container-fluid" id="content" >
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="panel panel-primary">
<div class="panel-heading" align="center">
<h3 class="panel-title" style="font-size:50px;">Add Product</h3>
</div><!--end of heading-->
<div class="panel-body" style="padding:30px;">
<div class="col-md-12">
<?php
if(isset($_GET['message']) && $_GET['message']==1)
{
?>
<div class="alert alert-success">
<strong><span class="glyphicon glyphicon-ok"></span> Add Product Success.</strong>
</div>
<?php }else if(isset($_GET['message'])){
?>
<div class="alert alert-danger">
<span class="glyphicon glyphicon-remove"></span><strong> <?php echo $_GET['message'];?></strong>
</div>
<?php }else{ ?>
<br>
<?php }?>
</div>
<form role="form" class="form-horizontal" method="post" action="action/doAddProduct.php" id="addProductForm" enctype="multipart/form-data">
<div class="form-group">
<label class="col-md-3 col-md-offset-1" for="txtProductName">
Product Name <label class="text-danger">*</label>
</label>
<div class="col-md-7">
<input type="text" class="form-control" name="txtProductName" id="txtProductName" placeholder="Enter Product Name" value="<?php if(isset($_GET['productname'])){echo $_GET['productname'];}?>" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-md-offset-1" for="ddlCategory">
Category<label class="text-danger">*</label>
</label>
<div class="col-md-7">
<select name="ddlCategory" id="ddlCategory" class="form-control">
<?php
include('action/connect.php');
$query = "SELECT * FROM msCategory"." ORDER BY CategoryName ASC";
$result = mysql_query($query);
while($r = mysql_fetch_array($result))
{ ?>
<option value="<?php echo $r['CategoryID']?>" <?php if(isset($_GET['category']) && $_GET['category']==$r['CategoryID']){echo 'selected';} ?> >
<?php echo $r['CategoryName']?>
</option>
<?php }
?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-md-offset-1">
Product Image <label class="text-danger">*</label>
</label>
<div class="col-md-7">
<input type="file" name="filePhoto" id="filePhoto">
<p class="help-block">
Allowed formats: jpeg, jpg, png
</p>
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-md-offset-1" for="txtStock">
Stock <label class="text-danger">*</label>
</label>
<div class="col-md-7">
<input type="text" class="form-control" name="txtStock" id="txtStock" placeholder="Enter Stock" value="<?php if(isset($_GET['stock'])){echo $_GET['stock'];}?>" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-md-offset-1" for="txtPrice">
Price <label class="text-danger">*</label>
</label>
<div class="col-md-7">
<input type="text" class="form-control" name="txtPrice" id="txtPrice" placeholder="Enter Price" value="<?php if(isset($_GET['price'])){echo $_GET['price'];}?>" >
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-md-offset-1" for="txtDescription">
Description
</label>
<div class="col-md-7">
<textarea class="form-control" rows="5" id="txtDescription" name="txtDescription" form="addProductForm" style="resize:none";><?php if(isset($_GET['description'])){echo $_GET['description'];}?></textarea>
</div>
</div>
<br>
<div align="center">
<button type="submit" class="btn btn-primary" id="btnSubmit" name="btnSubmit">
Submit
</button>
<a href="product_new.php" class="btn btn-primary">
Reset
</a>
</div>
</form>
</div><!--end of panel body-->
</div><!--end of panel-->
</div><!--end of col-->
</div><!--end row-->
</div>
<?php
include('footer.php');
?>