-
Notifications
You must be signed in to change notification settings - Fork 0
/
Product_Addition.php
45 lines (40 loc) · 1.63 KB
/
Product_Addition.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
<?php
include 'init.php';
include 'connect.php';
$prodName=$_POST['prodName'];
$colour=$_POST['colour'];
$size=$_POST['size'];
$price=$_POST['price'];
$quantity=$_POST['quantity'];
$selectCategory=$_POST['selectCategory'];
$selectTargetMarket=$_POST['selectTargetMarket'];
$selectType=$_POST['selectType'];
$selectBrand=$_POST['selectBrand'];
$prodImage=$_POST['prodImage'];
$prodImage2=$_POST['prodImage2'];
$prodImage3=$_POST['prodImage3'];
if($selectCategory==1 || $selectCategory==6 || $selectCategory==7)
{
$tableName="clothing";
}
elseif($selectCategory==2 || $selectCategory==8 || $selectCategory==9)
{
$tableName="footware";
}
else
{
$tableName="equipment";
}
if($selectTargetMarket==5)
{
$insert = "insert into $tableName (name,color,size,price,quantity,category,Type,Brand,picture,picture2,picture3,dateAdded) values ('$prodName', '$colour', '$size', '$price','$quantity', '$selectCategory', '$selectType', '$selectBrand', '$prodImage', '$prodImage2', '$prodImage3', curdate())";
}
else
{
$insert = "insert into $tableName (name,color,size,price,quantity,category,targetMarket,Type,Brand,picture,picture2,picture3,dateAdded) values ('$prodName', '$colour', '$size', '$price','$quantity', '$selectCategory', '$selectTargetMarket','$selectType', '$selectBrand', '$prodImage', '$prodImage2', '$prodImage3', curdate())";
}
$stmt = $conn->prepare($insert);
$stmt->execute();
header("Location: http://localhost/Tennis_Joint/confirmationAddProduct.php");
$conn->close();
?>