-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvote.php
175 lines (153 loc) · 6.14 KB
/
vote.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
<html>
<?php
include('session.php');
?>
<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">
<link href="css/vote.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="VoterHome.php">Home</a>
</li>
<li>
<a href="#services">Search Candidate</a>
</li>
<li>
<a href="#contact">Contact us</a>
</li>
<li>
<a href="VLogout.php">Log Out</a>
</li>
</ul>
</div>
</div>
</div>
<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="vote.php" method="post">
<fieldset>
<!-- Form Name -->
<h2> Ballot Papers </h2>
<hr class="colorgraph">
<div class='form-group '><b>
<label class='col-md-3 col-md-3 control-label'>Election Name </label>
<div class='col-sm-9'>
<input name='election' class='form-control' type='text' value='Presidential election' disabled>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>Party Name</label>
<div class='col-sm-9'>
<select name='party_name' class='form-control' >
<option> Select Party </option>
<option>New Democratic Front </option>
<option>United People's Freedom Alliance</option>
<option>Our National Front </option>
<option>Tamil National Alliance </option>
<option>Janatha Vimukthi Peramuna </option>
<option>Sri Lanka Muslim Congress</option>
</select>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>Candidate Name</label>
<div class='col-sm-9'>
<select name='candidate_name' class='form-control' >
<option> Select Candidate </option>
<option>Maithripala Sirisena</option>
<option>Mahinda Rajapaksa</option>
<option>Ahamed Hasny </option>
<option>Namal Ajith Rajapaksa</option>
<option>Maulawi Ibrahim Mohanmed Mishlar</option>
<option>A. S. P. Liyanage</option>
</select>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>Province Name</label>
<div class='col-sm-9'>
<input name='province' class='form-control' type='text' value='Western Province' disabled>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>Districts Name</label>
<div class='col-sm-9'>
<input name='districs' class='form-control' type='text' value='Gampaha' disabled>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>Seat Name</label>
<div class='col-sm-9'>
<input name='seat' class='form-control' type='text' value='Ja Ela' disabled>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>Date</label>
<div class='col-sm-9'>
<input name='date' class='form-control' type='text' value='2016.05.05' disabled>
</div>
</div>
<div class='form-group '>
<label class='col-md-3 col-md-3 control-label'>UserId</label>
<div class='col-sm-9'>
<input name='userid' class='form-control' type='text' value='00001' disabled>
</div>
</div>
</b>
<hr class='colorgraph'>
<div id='button' align="center">
<input type='submit' name='submit' value='vote' class='btn btn-primary'/>
<input action="action" type="button" class="btn btn-info btn-cons" value="clear" />
<input type="button" onclick="window.open('http://www.slelections.gov.lk/web/index.php/en/recognized-political-parties')" value="Help" class="btn btn-warning btn-cons">
</div>
</fieldset>
</form>
<b>You can browse party and candidate details here </b>
<br>
<input type="button" onclick="window.open('http://www.slelections.gov.lk/web/index.php/en/recognized-political-parties')" value="View Party" class="btn btn-success btn-cons">
<input type="button" onclick="window.open('https://www.google.lk/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=sri+lankan+politicians+names')" value="View Candidate" class="btn btn-success btn-cons">
</div>
</div>
</div>
<?php
require'database.php';
$election = isset($_POST['election']) ? $_POST['election'] : '';
$party_name = isset($_POST['party_name']) ? $_POST['party_name'] : '';
$candidate_name = isset($_POST['candidate_name']) ? $_POST['candidate_name'] : '';
$province = isset($_POST['province']) ? $_POST['province'] : '';
$districs = isset($_POST['districs']) ? $_POST['districs'] : '';
$seat = isset($_POST['seat']) ? $_POST['seat'] : '';
$date = isset($_POST['date']) ? $_POST['date'] : '';
$userid = isset($_POST['userid']) ? $_POST['userid'] : '';
if (isset($_POST['submit'])) {
$sql="INSERT INTO `election_vote`(`election_name`, `party_name`, `candidate_name`, `province_name`, `districts_name`, `seat_name`, `date`, `user_id`)
VALUES ('$election','$party_name','$candidate_name','$province','$districts','$seat','$date' ,'$userid')";
if (!mysqli_query($con,$sql)) {
echo '<script language="javascript">';
echo 'alert("You can not remain empty any filed")';
echo '</script>';
die( mysql_error());
}else{
echo '<script language="javascript">';
echo 'alert("You entered record is added.")';
echo '</script>';
}
}
mysqli_close($con)
?>
</body>
</html>