-
Notifications
You must be signed in to change notification settings - Fork 0
/
userchoice.php
84 lines (75 loc) · 1.73 KB
/
userchoice.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
<?php
require_once 'dbconfig.php';
if(isset($_POST['add'])) {
$pid = $_POST['pid'];
$pn = $_POST['pn'];
$pc = $_POST['pc'];
$pq = $_POST['pq'];
if($pid=="" || !is_numeric ($pid)) {
$errMSG = "Please Enter Valid Product ID";
}
else if($pn=="") {
$errMSG = "Please Enter Valid Product Name";
}
else if($pc=="" || !is_numeric ($pc)) {
$errMSG = "Please Enter Valid Product Cost";
}
else if($pq=="" || !is_numeric ($pq)) {
$errMSG = "Please Enter Valid Quantity Value";
}
else {
$stmt = $DB_con->prepare('INSERT INTO products(pid,pname,pcost,pqty) VALUES(:a, :b, :c, :d)');
$stmt->bindParam(':a',$pid);
$stmt->bindParam(':b',$pn);
$stmt->bindParam(':c',$pc);
$stmt->bindParam(':d',$pq);
if($stmt->execute())
{
$errMSG = "Your Product Details Are Added To Stock";
header("refresh:1;product_add.php");
}
else
{
$errMSG = "Unable To Add Product Details";
}
}
}
if(isset($_POST['clear'])) {
header("Location: product_add.php"); /* Redirect browser */
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Add Products</title>
<link rel="stylesheet" href="css/style.css" type="text/css">
</head>
<body>
<div id="background">
<div id="page">
<div id="header">
<div id="logo">
<a href="index.html"><img src="images/metrologo.png" alt="LOGO" height="112" width="250"></a>
</div>
<div id="navigation">
<ul>
<li>
<a href="userregister.php">register</a>
</li>
<li >
<a href="userproductview.php">prod avail</a>
</li>
</ul>
</div>
</div>
</div>
<div id="footer">
<p>
© 2020 by Product Sales Management System. All Rights Reserved
</p>
</div>
</div>
</body>
</html>