-
Notifications
You must be signed in to change notification settings - Fork 0
/
editb.php
77 lines (56 loc) · 1.59 KB
/
editb.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
<?php
include('config.php');
if (isset($_POST['submit']))
{
$id=$_POST['id'];
$quantity=mysqli_real_escape_string($db, $_POST['quantity']);
mysqli_query($db,"UPDATE resources SET quantity='$quantity' WHERE product_id='$id'");
header("Location:blood_bank.php");
}
if (isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id'] > 0)
{
$id = $_GET['id'];
$result = mysqli_query($db,"SELECT * FROM resources WHERE product_id=".$_GET['id']);
$row = mysqli_fetch_array($result);
if($row)
{
$id = $row['product_id'];
$quantity=$row['quantity'];
}
else
{
echo "No results!";
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Edit Item</title>
</head>
<body>
<form action="" method="post" action="editb.php">
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<table border="1">
<tr>
<td colspan="2"><b>
<font color='Red'>Edit Records </font>
</b></td>
</tr>
<tr>
<td width="179"><b>
<font color='#663300'>Quantity<em>*</em></font>
</b></td>
<td><label>
<input type="text" name="quantity" value="<?php echo $quantity;?>" />
</label></td>
</tr>
<tr align="Right">
<td colspan="2"><label>
<input type="submit" name="submit" value="Save">
</label></td>
</tr>
</table>
</form>
</body>
</html>