-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadminPanel.php
More file actions
116 lines (104 loc) · 3.77 KB
/
adminPanel.php
File metadata and controls
116 lines (104 loc) · 3.77 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
<?php
include('functions.php');
?>
<?php
if (isset($_POST['search'])) {
$valueToSearch = $_POST['valueToSearch'];
// search in all table columns
// using concat mysql function
$query = "SELECT * FROM `sample-data`
WHERE `sample-data`.`SKU` = '" . $valueToSearch . "'";
$search_result = filterTable($query);
} else {
$query = "SELECT * FROM `sample-data`";
$search_result = filterTable($query);
}
// function to connect and execute the query
function filterTable($query)
{
include "configTrumbullIndustries.php";
$filter_Result = mysqli_query($conn, $query);
return $filter_Result;
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Trumbull Industries 2.4</title>
<style>
table,
tr,
th,
td {
border: 1px solid black;
}
</style>
</head>
<body>
<form action="import.php" method="post" enctype="multipart/form-data">
<input type="file" name="upcsv" accept=".csv" required>
<input type="submit" name="Import" value="Upload">
</form>
<br><br>
<form action="adminPanel.php" method="POST">
<!--This section Will allow for a filter if needed
<select name="valueToSearch" id="skuSelect">
<?php
/* echo "<br>Trumbull Industries";
require 'configTrumbullIndustries.php';
$sql = "SELECT DISTINCT `SKU`FROM `sample-data`
ORDER BY `sample-data`.`SKU` ASC ";
$res = mysqli_query($conn,$sql);
while( $row = mysqli_fetch_array($res)){ */ ?>
<option value="<?php /*echo $row['SKU'];*/ ?> " >
<?php /*echo $row['SKU']; */ ?> </option>
<?php /*} */ ?>
</select>
<input type="submit" name="search" value="Filter">-->
<button type="button" onclick="window.location.href = 'addNew.php';">Add New Entry</button>
<br><br>
<table>
<tr>
<th>ID</th>
<th>SKU</th>
<th>TSI</th>
<th>VENDOR</th>
<th>BRAND</th>
<th>SHIPPING TEMPLATE</th>
<th>TEMPLATE CODE</th>
<th>INSTOCK LEADTIME</th>
<th>NOSTOCK LEADTIME</th>
<th>QUANTITY</th>
<th>OBSOLETE</th>
<th>IS UPDATED</th>
<th>EDIT | DELETE</th>
</tr>
<!-- populate table from mysql database -->
<?php while ($row = mysqli_fetch_array($search_result)) : ?>
<tr>
<td><?php echo $row['ID']; ?></td>
<td><?php echo $row['SKU']; ?></td>
<td><?php echo $row['TSI']; ?></td>
<td><?php echo $row['VENDOR']; ?></td>
<td><?php echo $row['BRAND']; ?></td>
<td><?php echo $row['SHIPPING TEMPLATE']; ?></td>
<td><?php echo $row['TEMPLATE CODE']; ?></td>
<td><?php echo $row['INSTOCK LEADTIME']; ?></td>
<td><?php echo $row['NOSTOCK LEADTIME']; ?></td>
<td><?php echo $row['QUANTITY']; ?></td>
<td><?php echo $row['OBSOLETE']; ?></td>
<td><?php echo $row['IS UPDATED']; ?></td>
<td>
<a href="edit.php?id=<?php echo $row['ID']; ?>">Edit</a>
<a> | </a>
<a href="delete.php?id=<?php echo $row['ID']; ?>">Delete</a>
</td>
</tr>
<?php endwhile; ?>
</table>
</form>
<form action="export.php" method="post">
<input type="submit" name="Export" value="Export">
</form>
</body>
</html>