-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrecipt.php
124 lines (85 loc) · 2.55 KB
/
recipt.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
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
<?php
session_start();
if(!$_SESSION['email'])
{
header("Location: login.php");//redirect to login page to secure the welcome page without login access.
}
if(isset($_POST['submit'])){
$data_missing = array();
if(empty($_POST['memo_no'])){
$data_missing[] = ' Cash Memo No ';
} else{
$memo_no = trim($_POST['memo_no']);
}
if(empty($_POST['date'])){
$data_missing[] = ' date ';
} else{
$date = trim($_POST['date']);
}
if(empty($_POST['source'])){
$data_missing[] = ' Brought From ';
} else{
$source = trim($_POST['source']);
}
if(empty($data_missing)){
$connection = mysqli_connect("localhost","root","","hstore");
$query = "INSERT INTO reciepts(cmemo_no, r_date, brought_from) VALUES ('$memo_no','$date','$source');";
$result = mysqli_query($connection, $query);
if ($result)
//success
echo "successful";
else
{
die("Database query not working. " . mysqli_error($connection));
}
} else {
echo 'You need to enter the following data<br />';
foreach($data_missing as $missing){
echo "$missing<br />";
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Product Reciepts</title>
<link rel="stylesheet" href="./resources/css/master.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="resources/js/script.js" charset="utf-8"></script>
<script src="resources/js/jquery.min.js"></script>
</head>
<body>
<header>
<?php include_once 'template/header.php'; ?>
</header>
<div class="container">
<form name="regform" action="" method="POST" >
<div class="center">
<h1> Product Recipt </h1>
</div>
<table class="table table-condensed">
<tr>
<td>Cash Memo No. :</td><td><input type="text" name="memo_no" placeholder="Memo No." class="form-control"></td>
</tr>
<tr>
<td>Date :</td><td><input type="date" name="date" placeholder="date" class="form-control"></td>
</tr>
<tr>
<td>Brought From :</td><td><input type="text" name="source" placeholder="Brought From" class="form-control"></td>
</tr>
</div>
</table>
<div class="right" >
<tr>
<td></td><td><input type="submit" name="submit" value=" Submit " class="btn btn-primary btn-block" ></td>
</tr>
</div>
</form>
<br>
<br>
<div class="modal-footer text-right">
<a href="addproduct.php">Add product? Add!</a> <br>
</div>
</body>
</html>