-
Notifications
You must be signed in to change notification settings - Fork 1
/
productadd.php
53 lines (39 loc) · 2 KB
/
productadd.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
<?php
error_reporting(0);
session_start();
$msg = "";
$db = mysqli_connect("localhost", "root", "", "myshopdb");
if (isset($_POST['addbtn']))
{
$pname = mysqli_real_escape_string($db, $_POST['pname']);
$pmrp = mysqli_real_escape_string($db, $_POST['pmrp']);
$pprice = mysqli_real_escape_string($db, $_POST['pprice']);
$psave = mysqli_real_escape_string($db, $_POST['psave']);
$off = mysqli_real_escape_string($db, $_POST['off']);
$cata = mysqli_real_escape_string($db, $_POST['cata']);
$catb = mysqli_real_escape_string($db, $_POST['catb']);
$catc = mysqli_real_escape_string($db, $_POST['catc']);
$catd = mysqli_real_escape_string($db, $_POST['catd']);
$pquality = mysqli_real_escape_string($db, $_POST['pquality']);
$pavail = mysqli_real_escape_string($db, $_POST['pavail']);
$pla= mysqli_real_escape_string($db, $_POST['pla']);
$plb = mysqli_real_escape_string($db, $_POST['plb']);
$plc = mysqli_real_escape_string($db, $_POST['plc']);
$pld = mysqli_real_escape_string($db, $_POST['pld']);
$ple = mysqli_real_escape_string($db, $_POST['ple']);
$pdesc = mysqli_real_escape_string($db, $_POST['pdesc']);
$pimgadd = time().$_FILES['imgadd']['name'];
$target = "images/" . $pimgadd;
move_uploaded_file($_FILES['imgadd']['tmp_name'], $target);
$sql5 = "INSERT INTO productinfo(pname, pmrp, pprice, psave, off, cata, catb, catc, catd, pquality, pavailable, pla, plb, plc, pld, ple, pdesc, pimgadd) VALUES('$pname', '$pmrp', '$pprice', '$psave', '$off','$cata','$catb','$catc','$catd','$pquality', '$pavail', '$pla', '$plb', '$plc', '$pld', '$ple', '$pdesc', '$pimgadd')";
$db = mysqli_connect("localhost", "root", "", "myshopdb");
mysqli_query($db, $sql5);
include 'addproduct.php';
}
?>
<script>
alert("<?php
$pname = mysqli_real_escape_string($db, $_POST['pname']);
echo "$pname, Successfully Added!";
?>");
</script>