-
Notifications
You must be signed in to change notification settings - Fork 0
/
singing.php
139 lines (120 loc) · 5.72 KB
/
singing.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
<?php
include 'Database.php';
include 'config.php';
?>
<?php
$db = new Database();
$query = "SELECT * FROM registration";
$read = $db->select($query);
$query1 = "SELECT * FROM judges";
$read1 = $db->select($query1);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Singing Judge Panel</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link rel="stylesheet" href="assets/css/judge_style.css">
<link rel="shortcut icon" href="./assets/images/user.svg" type="image/x-icon">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<center><img src="https://geetauniversity.edu.in/wp-content/uploads/2022/07/GU-Logo-768x349-1-removebg-preview.png" style="height:130px; width:150px" class="img-fluid pt-4 pb-3"></center>
<h4 class="text-center">16th InterSchool Group Dance, Singing and Declamation Competition</h4>
<div class="card">
<div class="card-header">
<h3 class="card-title text-center">Singing Competition</h3>
</div>
<div class="card-body">
<div id="singingForm">
<form action="" method="post">
<label for="team_id">Select your Team Id:</label>
<select name="team_id" id="team_id" class="form-control">
<?php if($read){ ?>
<?php
$i=0;
while($row = $read->fetch_assoc()){
$i++;
?>
<option value="<?php echo $row['team_id']?>">S<?php echo $row['team_id']?></option>
<?php } ?>
<?php }else{ ?>
<p>Data is not Found!</p>
<?php } ?>
</select><br>
<label for="judge_id">Select your Judge Id:</label>
<select name="judge_id" id="judge_id" class="form-control">
<?php if($read1){ ?>
<?php
$i=0;
while($row1 = $read1->fetch_assoc()){
$i++;
?>
<option value="<?php echo $row1['name']?>"><?php echo $row1['name']?></option>
<?php } ?>
<?php }else{ ?>
<p>Data is not Found!</p>
<?php } ?>
</select>
<h4 class="pt-2 pb-2 text-center">Enter the marks in given inputs:</h4>
<p class="text-danger" style="font-size:18px">(The value must be less than or equal to 20)</p>
<label for="song_choice">Song Choice</label><br>
<input type="number" class="form-control" id="song_choice" name="song_choice" required max="20">
<label for="vocal_quality">Vocal Quality</label><br>
<input type="number" class="form-control" id="vocal_quality" name="vocal_quality" required max="20">
<label for="creativity">Creativity</label><br>
<input type="number" class="form-control" id="creativity" name="creativity" required max="20">
<label for="rhythm_timing">Rhythm & Timing</label><br>
<input type="number" class="form-control" id="rhythm_timing" name="rhythm_timing" required max="20">
<label for="coordination">Coordination</label><br>
<input type="number" class="form-control" id="coordination" name="coordination" required max="20"><br>
<input type="submit" name="singing_submit" id="submit">
</form>
</div>
</div>
<div class="card-footer">
<h6 class="card-title text-center">Made by Geeta Technical Hub</h6>
</div>
</div>
</div>
</div>
</div>
<?php
$db = new Database();
if(isset($_POST['singing_submit'])){
$song_choice = mysqli_real_escape_string($db->link, $_POST['song_choice']);
$vocal_quality = mysqli_real_escape_string($db->link, $_POST['vocal_quality']);
$creativity = mysqli_real_escape_string($db->link, $_POST['creativity']);
$rhythm_timing = mysqli_real_escape_string($db->link, $_POST['rhythm_timing']);
$coordination = mysqli_real_escape_string($db->link, $_POST['coordination']);
$team_id = mysqli_real_escape_string($db->link, $_POST['team_id']);
$judge_id = mysqli_real_escape_string($db->link, $_POST['judge_id']);
$total = (int)$song_choice + (int)$vocal_quality + (int)$creativity + (int)$rhythm_timing + (int)$coordination;
$duplicate = "SELECT * FROM singing_score WHERE team_id = '$team_id' AND judge_id = '$judge_id'";
$check = $db->select($duplicate);
if($song_choice == "" || $vocal_quality == "" || $creativity == "" || $rhythm_timing == "" || $coordination == "" || $team_id == "" || $judge_id == ""){
$error = "Field must not be Empty !!";
} else {
if($check){
$error = "This team has already been scored by this judge."; ?>
<?php if(isset($error)){ ?>
<script>
alert("<?php echo $error ?>");
</script>
<?php } ?>
<?php
} else {
$query = "INSERT INTO singing_score(`team_id`, `judge_id`, `song_choice`, `vocal_quality`, `coordination`, `creativity`, `rhythm_timing`, `total`)
VALUES('$team_id', '$judge_id', '$song_choice', '$vocal_quality', '$coordination', '$creativity', '$rhythm_timing', '$total')";
$create = $db->insert($query);
}
}
}
?>
</body>
</html>