-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdistrict.php
166 lines (127 loc) · 6.05 KB
/
district.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
<?php session_start();
include("menu.php");
include("dbh.php");
if(!isset($_SESSION['id'])){
header("location:index.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>navbar</title>
<link rel="stylesheet" type="text/css" href="innerstyle.css?version=1.0.1">
<link rel="stylesheet" type="text/css" href="form.css">
<link rel="stylesheet" type="text/css" href="js/slick.css">
</head>
<body>
<div class="content">
<?php create_topmenu(4); ?>
<div class="clr">
<h3>District Level Winners</h3>
<div class="container">
<form action="districtsave.php" method="POST">
District code                    <input type="text" id="districtcode" name="did" placeholder="--District code--"><br>
Block code                     
<select id="block" name="bid">
<option value="--select--">--select--</option>
<?php
$sql="SELECT * FROM block ORDER BY b_id";
//$result=$conn->query($sql);
$result = mysqli_query($conn,$sql);
//var_dump($result);
$rows = mysqli_num_rows($result);
// get number of rows returned
//var_dump($rows);
if ($rows) {
while ($row = mysqli_fetch_array($result)) {
echo '<option value="'.$row['b_id'].'">'.$row['b_id'].'</option>';
}
}
?>
</select><br>
Participant code             
<select id="pcode" name="pcode">
<option value="--select--">--select--</option>
<?php
$sql="SELECT a.p_code FROM entry a,block b where a.p_code=b.p_code ORDER BY p_code";
//$result=$conn->query($sql);
$result = mysqli_query($conn,$sql);
//var_dump($result);
$rows = mysqli_num_rows($result);
// get number of rows returned
//var_dump($rows);
if ($rows) {
while ($row = mysqli_fetch_array($result)) {
echo '<option value="'.$row['p_code'].'">'.$row['p_code'].'</option>';
}
}
?>
</select><br>
Participant Name            <input type="text" id="fname" name="pname" placeholder="--Enter Participant name--"><br>
Gender                          
<input type="text" id="gen" name="gender" placeholder="--gender--"><br>
School Address              <input type="text" id="school" name="sadddress" placeholder="--Enter School address--"><br>
Class                              <input type="text" id="cls" name="class" placeholder="--Enter Class--"><br>
Phone no.                       <input type="text" id="pno" name="pno" placeholder="--Enter Your phone no.--"><br>
Competition Details        <input type="text" id="com" name="cdetails" placeholder="--Enter Competition Details--"><br>
Rank                              
<select id="rank" name="rank">
<option value="--select--">--select--</option>
<option value="1st">First</option>
<option value="2nd">Second</option>
<option value="3rd">Third</option>
<option value="Consolation">Consolation</option>
</select><br>
State                               <input type="text" id="state" name="state" placeholder="--state--"><br>
District                            <input type="text" id="district" name="district" placeholder="--district--"><br>
Block                              <input type="text" id="bl" name="block" placeholder="--block--"><br>
<br>
<input type="submit" value="SAVE">  
</form>
</div>
</div>
</div>
<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="js/slick.js"></script>
<script>
<?php if(isset($_GET['success']) && $_GET['success']=="true"){
?>
alert("Data Saved");
<?php } ?>
$(document).ready(function(){
$('.slide').slick({
autoplay: true,
accessibility: false,
arrows: false,
autoplaySpeed: 3000
});
$("#pcode").change(function(){
var did=$(this).val();
//alert(did);
$.ajax({
url : 'blockaction.php',
type : "GET",
data : "pid="+did,
cache: false,
processData:false,
mimeType:"multipart/form-data"
}).done(function(res){
if(res){
var data=jQuery.parseJSON(res);
console.log(data);
$("#fname").val(data[1]);
$("#school").val(data[2]);
$("#cls").val(data[3]);
$("#pno").val(data[4]);
$("#com").val(data[5]);
$("#state").val(data[6]);
$("#district").val(data[7]);
$("#bl").val(data[8]);
$("#gen").val(data[9]);
}
});
});
});
</script>
</body>
</html>