-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata-log.php
More file actions
133 lines (109 loc) · 4.67 KB
/
data-log.php
File metadata and controls
133 lines (109 loc) · 4.67 KB
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
<?php
session_start();
include("../../db.php");
if(isset($_POST['btn_save']))
{
$product_name=$_POST['product_name'];
$details=$_POST['details'];
$price=$_POST['price'];
$c_price=$_POST['c_price'];
$product_type=$_POST['product_type'];
$brand=$_POST['brand'];
$tags=$_POST['tags'];
//picture coding
$picture_name=$_FILES['picture']['name'];
$picture_type=$_FILES['picture']['type'];
$picture_tmp_name=$_FILES['picture']['tmp_name'];
$picture_size=$_FILES['picture']['size'];
if($picture_type=="image/jpeg" || $picture_type=="image/jpg" || $picture_type=="image/png" || $picture_type=="image/gif")
{
if($picture_size<=50000000)
$pic_name=time()."_".$picture_name;
move_uploaded_file($picture_tmp_name,"../product_images/".$pic_name);
mysqli_query($con,"insert into products (product_cat, product_brand,product_title,product_price, product_desc, product_image,product_keywords) values ('$product_type','$brand','$product_name','$price','$details','$pic_name','$tags')") or die ("query incorrect");
header("location: sumit_form.php?success=1");
}
mysqli_close($con);
}
include "sidenav.php";
include "topheader.php";
?>
<!-- End Navbar -->
<div class="content">
<div class="container-fluid">
<form action="" method="post" type="form" name="form" enctype="multipart/form-data">
<div class="row">
<div class="col-md-7">
<div class="card">
<div class="card-header card-header-primary">
<h5 class="title">Add Product</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Product Title</label>
<input type="text" id="product_name" required name="product_name" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="">
<label for="">Add Image</label>
<input type="file" name="picture" required class="btn btn-fill btn-success" id="picture" >
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label>Description</label>
<textarea rows="4" cols="80" id="details" required name="details" class="form-control"></textarea>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label>Pricing</label>
<input type="text" id="price" name="price" required class="form-control" >
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-5">
<div class="card">
<div class="card-header card-header-primary">
<h5 class="title">Categories</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Product Category</label>
<input type="number" id="product_type" name="product_type" required="[1-6]" class="form-control">
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="">Product Brand</label>
<input type="number" id="brand" name="brand" required class="form-control">
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label>Product Keywords</label>
<input type="text" id="tags" name="tags" required class="form-control" >
</div>
</div>
</div>
</div>
<div class="card-footer">
<button type="submit" id="btn_save" name="btn_save" required class="btn btn-fill btn-primary">Update Product</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<?php
include "footer.php";
?>