-
Notifications
You must be signed in to change notification settings - Fork 0
/
giftCardEditor.php
94 lines (91 loc) · 2.12 KB
/
giftCardEditor.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
<?php
session_start();
ob_start();
?>
<!--
giftCardEditor.php
-->
<?php
session_start();
include('header.php');
?>
<html>
<body>
<?php
include('siteNavigator.php');
?>
<h1>Manage Gift Cards</h1>
<h2>You can update gift card information on this page</h2>
<form action = "editGiftCard.php" method = "POST">
<table>
<tr>
<td>Search for gift cards</td>
<td><input type = "text" name = "searchtext"></td>
</tr>
<tr>
<td>Look up by vendor ID</td>
<td><input type = "radio" name = "searchtype" value = 'vendorID'/></td>
</tr>
<tr>
<td>Look up by vendor name</td>
<td><input type = "radio" name = "searchtype" value = 'vendorName' CHECKED /></td>
</tr>
<tr><td><br/>
<input type = "submit" value = "Search" id="submit" />
</td></tr>
<!--<tr><td></td></tr> -->
</table>
</form>
<?php
$query = "SELECT orderFormCardID id FROM giftcards;";
$result = mysqli_query($db, $query);
while ($row = mysqli_fetch_array($result)){
$id = $row['id'];
if (!empty($_REQUEST["$id"])){
$query = "SELECT * FROM giftcards WHERE orderFormCardID = '$id';";
$result2 = mysqli_query($db, $query);
if ($row2 = mysqli_fetch_array($result2)){
$name = $row2['vendor'];
$cost = $row2['cost'];
$percent = $row2['percent'];
if($row2['isAvailable'] == 1){
$available = "yes";
}else{
$available = "no";
}
}
//still need to make a form here!
echo "
<table>
<tr>
<td><h1>$name</h1></td>
</tr>
<tr>
<td>Cost: </td>
<td><input type = 'text' value = '$$cost.00' disabled = 'disabled'/></td>
<td><input type = 'text' name = 'cost'>
</tr>
<tr>
<td>Percent Return:</td>
<td><input type = 'text' value = '$percent%' disabled = 'disabled'></td></td>
<td><input type = 'text' name = 'percent'/></td>
</tr>
<tr>
<td>Availability:</td>
<td><input type = 'text' value = '$available' disabled = 'disabled'></td></td>
<td><input type = 'text' name = 'available'/></td>
</tr>
<tr><td><input type = 'submit' value ='submit'/></td>
</tr>
</table>
";
}
}
?>
</div>
<!-- Page info goes above-->
<?php
include('footer.php');
?>
</body>
</html>