-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrough.php
91 lines (83 loc) · 3.22 KB
/
rough.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
<?php
include "config.php";
// Check user login or not
if(!isset($_SESSION['username'])){
header('Location: index.php');
}
// logout
if(isset($_POST['logout'])){
session_destroy();
header('Location: index.php');
}
?>
<!doctype html>
<html>
<head>
<title>SRC</title>
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
<script>
var limit = 2;
$(document).ready(function() {
$('input[type=checkbox]').on('change', function(evt) {
if ($("input[name='gm']:checked").length > limit) {
this.checked = false;
alert("allowed only 2");
}
});
});
</script>
</head>
<body>
<h1>Voting Page</h1>
<form method='post' action="">
<li style="float:right">
<input type="submit" value="Logout" name="logout">
</li>
</form>
<form action="/action_page.php">
<fieldset>
<legend>Choose a Slate:</legend>
<input type="radio" id="Slate1" name="slate" value="Slate1">
<label for="Slate1"> Slate 1</label>
<br>
<input type="radio" id="Slate2" name="slate" value="Slate2">
<label for="Slate2"> Slate 2</label>
<br>
<input type="radio" id="Slate3" name="slate" value="Slate3">
<label for="Slate3"> Slate 3</label>
<br>
</fieldset>
<fieldset>
<legend>Choose a General Member:</legend>
<input type="checkbox" id="Candidate1" name="gm" value="Candidate1">
<label for="Candidate1"> Name 1</label>
<br>
<input type="checkbox" id="Candidate2" name="gm" value="Candidate2">
<label for="Candidate2"> Name 2</label>
<br>
<input type="checkbox" id="Candidate3" name="gm" value="Candidate3">
<label for="Candidate3"> Name 3</label>
<br>
<input type="checkbox" id="Candidate4" name="gm" value="Candidate4">
<label for="Candidate4"> Name 4</label>
<br>
</fieldset>
<fieldset>
<legend>Choose a General Member:</legend>
<span>Choose a Sports Representative</span>
<br>
<input type="radio" id="sports1" name="sports" value="sports1">
<label for="sports1"> Candidate 1</label>
<br>
<input type="radio" id="sports2" name="sports" value="sports2">
<label for="sports2"> candidate 2</label>
<br>
<input type="radio" id="sports3" name="sports" value="sports3">
<label for="sports2"> Candidate 3</label>
<br>
</fieldset>
<br>
</form>
<input type="submit" value="Submit">
</body>
</html>