-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.php
More file actions
160 lines (132 loc) · 3.36 KB
/
Copy pathupdate.php
File metadata and controls
160 lines (132 loc) · 3.36 KB
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
session_start();
if(!isset($_SESSION['email']))
{
header("location:index(1).html");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Update Stock</title>
<meta name="description" content="website description" />
<meta name="keywords" content="website keywords, website keywords" />
<meta http-equiv="content-type" content="text/html; charset=windows-1252" />
<link rel="stylesheet" type="text/css" href="style/style.css" />
</head>
<style type="text/css">
table {
background-color: #00C6F0;
color: white;
width: 80%;
height: 75%;
}
input[type=submit]{
width: 80%%;
background-color: #00C6F0;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=submit]:hover{
background-color: #00bbe6;
}
</style>
<?php
// Connect to server and select database.
include 'db.php';
include 'newhead.php';
$l=$_SESSION['labid'];
$sql="SELECT * FROM consumable WHERE labId='$l'";
$result=mysqli_query($con,$sql);
// Count table rows
$count=mysqli_num_rows($result);
?>
<div id="content">
<!-- insert the page content here -->
<h2>Consumable:</h2>
<form name="form1" method="post" action="updateb.php">
<tr>
<td>
<table width="100%" cellpadding="3">
<tr>
<th>Component ID</th>
<th>Value</th>
<th>Unit</th>
<th>Family</th>
<th>Number</th>
</tr>
<?php
while($rows=mysqli_fetch_array($result)){
?>
<tr>
<td><?php echo $rows['compId']; ?></td>
<input name="id[]" type="hidden" value="<?php echo $rows['compId']; ?>">
<td><?php echo $rows['value']; ?></td>
<td><?php echo $rows['unit']; ?></td>
<td><?php echo $rows['family']; ?></td>
<td><input type= "number" name="number[]" value="<?php echo $rows['number']; ?>" min="0"> </td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
<input type="submit" name="Submit" value="Update">
</form>
<h2>Capital:</h2><br>
<?php
$sql2="SELECT * FROM capital WHERE labId='$l'";
$result2 = mysqli_query($con, $sql2);
if (mysqli_num_rows($result2) > 0) {
$i=0;
echo "<table>
<tr>
<th>Component ID</th>
<th>Name</th>
<th>Description</th>
<th>Remove</th>
</tr>
";
// output data of each row
while($row = mysqli_fetch_assoc($result2)) {
$roll=$row['compId'];
$name=$row['name'];
$family=$row['description'];
echo "
<div id='movie_box2$i' class='dashdiv'>";
echo "<tr>";
echo "<td>".$roll."</td>";
echo "<td>".$name."</td>";
echo "<td>".$family."</td>";
echo "<td><a href='deletecapital.php?id=".$roll."'>Remove</a></td>";
echo "</tr>";
$i++;
echo "</div>";
}
}
?>
</div>
</div>
<!-- <div id="content_footer"></div>
<div id="footer">
<p><a href="index.php">Home</a> | <a href="request.php">Request</a> | <a href="stock.php">Stock</a> | <a href="return.php">Return</a>
| <a href="due.php">Dues</a> </p>
<p>Copyright © simplestyle_blue_trees | <a href="http://validator.w3.org/check?uri=referer">HTML5</a> | <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a> | <a href="http://www.html5webtemplates.co.uk">design from HTML5webtemplates.co.uk</a></p>
</div>
-->
</div>
<script>
function selects()
{
document.getElementById("stock").className = "selected";
}
</script>
<?php
mysqli_close($con);
?>
</html>