-
Notifications
You must be signed in to change notification settings - Fork 0
/
examplecutting.php
140 lines (132 loc) · 3.73 KB
/
examplecutting.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
session_start();
if (!isset($_SESSION['username'])) {
header("Location: index.php");
}
?>
<?php
$conn=mysqli_connect("localhost","root","","inward");
$sql='SELECT DISTINCT PARTYNAME FROM cloth';
$all_categories=mysqli_query($conn,$sql);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AVR Garment</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="cloth1.css">
<style>
body {
background-color: #F0F8FF ;
}
</style>
</head>
<body>
<div class="skin-black layout-boxed sidebar-mini">
<div class="row justify-content-center">
<div class="col-md-7">
<div class="card mt-5">
<div class="card-header text-center">
<h4>Cutting Entry</h4>
</div>
<div class="card-body">
<form method="post">
<table style="width:50%" align="center">
<tr>
<td><h5>Date<h5></td>
<td>
<input class="input100" type="date" name= "date" required></td>
</tr>
<tr>
<td><h5>Bill No.<h5></td>
<td>
<input class="input100" type="number" name= "billno" required></td>
</tr>
<tr>
<td><h5>Party Name<h5></td>
<td>
<select name="partyname" class="input100">
<?php
// use a while loop to fetch data
// from the $all_categories variable
// and individually display as an option
while ($cloth = mysqli_fetch_array(
$all_categories,MYSQLI_ASSOC)):;
?>
<option value="<?php echo $cloth["PARTYNAME"];
// The value we usually set is the primary key
?>">
<?php echo $cloth["PARTYNAME"];
// To show the category name to the user
?>
</option>
<?php
endwhile;
// While loop must be terminated
?>
</select>
</td>
</tr>
<tr>
<td><h5>Employee Name<h5></td>
<td>
<input class="input100" type="text" name= "employeename" required></td>
</tr>
<tr>
<td><h5>Used mtr<h5></td>
<td>
<input class="input100" type="float" name= "usedmtr" required></td>
</tr>
<tr>
<td><h5>Quantity<h5></td>
<td>
<input class="input100" type="number" name= "quantity" required></td>
</tr>
<tr>
<td></td>
<td><br>
<div class="col-md-4">
<button type="submit" name="submit" class="btn btn-primary">Submit</button></td>
</div>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
$con=mysqli_connect("localhost","root","","inward");
if(isset($_POST['submit']))
{
$d1=$_POST['date'];
$d2=$_POST['billno'];
$b1=$_POST['partyname'];
$l1=$_POST['employeename'];
$p1=$_POST['usedmtr'];
$q1=$_POST['quantity'];
$query="INSERT INTO cutting(DATE,BILLNO,PARTYNAME,EMPLOYEENAME,USEDMTR,QUANTITY) VALUES('$d1','$d2','$b1','$l1','$p1','$q1')";
$run=mysqli_query($con,$query);
if($run)
{
?>
<script>
alert ("Data Updated Successfully");
</script>
<?php
}
else
{
echo "Failed";
}
}
?>
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>