-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadd_product_code.php
47 lines (41 loc) · 1.15 KB
/
add_product_code.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
<?php
ob_start();
include 'database.php';
$productd_name=$_POST['p_name'];
$category=$_POST['catry'];
$price=$_POST['price'];
$photo=$_FILES["file"]["name"];
$despt=$_POST['desp'];
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
//echo "Upload: " . $_FILES["file"]["name"] . "<br />";
//echo "Type: " . $_FILES["file"]["type"] . "<br />";
//echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
//echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
if (file_exists("upload/". $_FILES["file"]["name"]))
{
echo $_FILES["file"]["namee"] . "already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
//echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
}
$i="insert into add_products values('','".$productd_name."','".$category."','".$price."','".$photo."','".$despt."')";
$vv=mysqli_query($con,$i) or die("error".mysqli_error());
if($vv)
{
//echo ("registed");
header("location:add_product.php");
}
else
{
echo ("Not registed");
}
?>