-
Notifications
You must be signed in to change notification settings - Fork 3
/
form1.php
208 lines (188 loc) · 6.95 KB
/
form1.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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<html>
<head>
<title>Online Election</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link href="css/head.css" rel="stylesheet">
<link href="css/form.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</head>
<body>
<div class="head">
<div class="container-fluid">
<div class="navbar-header">
<b>Online Election System</b>
</div>
<div>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="AdminHome.php">Home</a>
</li>
<li>
<a href="candidate_regtr_admin.php">Candidate Register</a>
</li>
<li>
<a href="registration_admin.php">Voter Register</a>
</li>
<li>
<a href="ALogout.php">Log Out</a>
</li>
</ul>
</div>
</div>
</div>
<?php
include('session3.php');
$id = null;
if ( !empty($_GET['id'])) {
$id = $_REQUEST['id'];
}
?>
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3">
<form class="form-horizontal" action="form1.php?id=<?php echo $id?>" method="post">
<fieldset>
<!-- Form Name -->
<h2>Candidate Register Form</h2>
<hr class="colorgraph">
<?php
require'database.php';
$sql = "SELECT * FROM candidate WHERE candidate_registr_no=$id";
$compltName=$login_session;
$compltDate = date("Y-m-d");
$result = $con->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "<div class='form-group'>
<label class='col-sm-3 control-label' for='card-holder-name'>Candidate Register No</label>
<div class='col-sm-9'>
<b><input name='candidate_registr_no' class='form-control' type='text' value=".$row["candidate_registr_no"]." disabled></b>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>Frist Name </label>
<div class='col-sm-9'>
<b><input name='frist_name' class='form-control' type='text' value=".$row["frist_name"]." disabled></b>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>Middle Name</label>
<div class='col-sm-9'>
<b><input name='middle_name' class='form-control' type='text' value=".$row["middle_name"]." disabled></b>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>Last Name</label>
<div class='col-sm-9'>
<b><input name='last_name' class='form-control' type='text' value=".$row["last_name"]." disabled></b>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>Date of Birth</label>
<div class='col-sm-9'>
<b><input name='date_of_birth' class='form-control' type='text' value=".$row["date_of_birth"]." disabled></b>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>NIC number</label>
<div class='col-sm-9'>
<b><input name='NIC_number' class='form-control' type='text' value=".$row["NIC_number"]." disabled></b>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>Gender</label>
<div class='col-sm-9'>
<b><input name='gender' class='form-control' type='text' value=".$row["gender"]." disabled></b>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>Permnent Address</label>
<div class='col-sm-9'>
<b><input name='permenent_address' class='form-control' type='text' value=".$row["permenent_address"]." disabled></b>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>Parliment Member</label>
<div class='col-sm-9'>
<b><input name='parliment_member' class='form-control' type='text' value=".$row["parliment_member"]." disabled></b>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>email</label>
<div class='col-sm-9'>
<b><input name='email' class='form-control' type='text' value=".$row["email"]." disabled></b>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>Request Date</label>
<div class='col-sm-9'>
<b> <input name='request_date' class='form-control' type='text' value=".$row["request_date"]." disabled> </b>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>Status</label>
<div class='col-sm-9'>
<b><select name='status' class='form-control'>
<option>".$row["status"]."</option>
<option value='Completed'>Completed</option>
<option value='Denied'>Denied</option>
</select> </b>
</div>
</div> <br/>
<hr class='colorgraph'>
<div id='button'>
<input type='submit' name='update' value='Approved' class='btn btn-primary'/> ";
echo '<input action="action" type="button" class="btn btn-primary" value="Back" onclick="history.go(-1);"/> </div>';
echo'<br>';
echo" <div class='form-group '>
<label class='col-sm-3 control-label'>Approved by</label>
<div class='col-sm-9'>
<b> <input name='compltName' type='text' value='$compltName' disabled> </b>
</div>
</div>
<div class='form-group '>
<label class ='col-md-3 col-md-3 '>Approved Date</label>
<div class='col-sm-9'>
<b> <input name='compltDate' type='text' value='$compltDate' disabled > </b>
</div>
</div> ";
}
} else {
echo "0 results";
}
?>
<?php
$candidate_registr_no=isset($_POST['candidate_registr_no']) ? $_POST['candidate_registr_no'] : '';
$status = isset($_POST['status']) ? $_POST['status'] : '';
$compltName = $login_session;
$compltDate = date("Y-m-d");
if(isset($_POST['update']))
{
$sql="UPDATE candidate SET status='$status', admin_name='$compltName',register_date='$compltDate' where candidate_registr_no =$id";
$q1=mysqli_query($con,$sql);
if($q1)
{
echo '<script type="text/javascript">';
echo 'alert("Successfully updated");';
echo 'window.location.href = "candidate_regtr_admin.php";';
echo '</script>';
}
else
{
echo '<SCRIPT LANGUAGE="JavaScript">
window.alert("Not updated Your Record");
window.location.href = "candidate_regtr_admin.php";
</SCRIPT>';
}
}
$con->close();
?>
</div>
</fieldset>
</form>
</div>
</div>
<div>
</body>
</html>