-
Notifications
You must be signed in to change notification settings - Fork 0
/
editcz.php
135 lines (121 loc) · 5.95 KB
/
editcz.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
<?php
include("pdo/connection.php");
error_reporting(0);
$cz_id = $_GET['cz_id'];
$query = "SELECT * from `czone` WHERE cz_id='$cz_id' ";
$cz = mysqli_query($conn, $query);
while ($rows = mysqli_fetch_array($cz)) {
$name = $rows['name'];
$locn = $rows['locn'];
$nop = $rows['no_patients'];
$mid = $rows['munic_id'];
$noh = $rows['no_hsp'];
$rem = $rows['remarks'];
}
?>
<html>
<head>
<title>Edit Containment Zone Record</title>
</head>
<body id="acz">
<?php include 'pdo/headers.php'; ?>
<link rel="stylesheet" href="pdo/style.css">
<br>
<h1 style="margin-left:10px;">Edit Containment Zone Details</h1><br>
<div id="form">
<form action="" method="GET">
<div class="container">
<div class="row justify-content-center">
<div class="col-8">
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="cz_id">Containment Zone ID* </label>
<div class="col-md-4">
<input type="text" class="form-control" name="cz_id" placeholder="enter cz_id" id="cz_id" value="<?php echo $_GET['cz_id']; ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="name">Name* </label>
<div class="col-md-4">
<input type="text" class="form-control" name="name" placeholder="enter name" id="name" value="<?php echo $name ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="locn">Location* </label>
<div class="col-md-4">
<input type="text" class="form-control" name="locn" placeholder="enter locn" id="locn" value="<?php echo $locn ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="nop">Number of Patients*</label>
<div class="col-sm-3">
<input type="text" class="form-control" name="nop" placeholder="enter no_patients" id="nop" value="<?php echo $nop ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="munic_id">Municipality ID* </label>
<div class="col-md-4">
<input type="text" class="form-control" name="munic_id" placeholder="enter munic_id" id="munic_id" value="<?php echo $mid ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="noh">Number of Hospitals*</label>
<div class="col-sm-3">
<input type="text" class="form-control" name="noh" placeholder="enter no_hosp" id="noh" value="<?php echo $noh ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="rem">Remarks*</label>
<div class="col-sm-3">
<textarea class="form-control" name="rem" placeholder="enter remarks" id="rem" value="<?php echo $rem ?>"></textarea>
</div>
</div>
</div><br>
</div>
</div>
</div>
<div class="row justify-content-center">
<button type="submit" class="btn btn-primary btn-large mb-2 " style="height:35px; width:70px;font-size:15px;" name="submit" value="submit" id="submit">Update</button>
</div>
</form>
</div><br>
<?php
if ($_GET['submit']) {
$czid = $_GET['cz_id'];
$name = $_GET['name'];
$locn = $_GET['locn'];
$nop = $_GET['nop'];
$mid = $_GET['munic_id'];
$noh = $_GET['noh'];
$rem = $_GET['rem'];
if ($czid != "" && $name != "" && $locn != "" && $nop != "" && $mid != "" && $noh != "" && $rem !== "") {
$query = "UPDATE czone SET name='$name',locn='$locn', no_patients='$nop', munic_id='$mid',no_hsp='$noh',remarks='$rem' WHERE cz_id='$cz_id'";
$res = mysqli_query($conn, $query);
if ($res) {
echo "<font color='green'><h4>DATA EDITED SUCCESSFULLY!</h4></font>";
} else {
echo "<font color='red'><h4>Some Error Occured </h4></font>";
}
} else {
echo "<font color='red'><h4>* fields are required!</h4></font>";
}
} else {
echo "<h3><font color='blue'>Click on Update to update you Record</font></h3>";
}
?><br>
<button type="submit" class="btn btn-outline-secondary mb-2" style="height:35px; width:70px;font-size:15px; margin-left:10px;">
<a href="cont.php">Back</a></button>
</body>
</html>