-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchoose.php
58 lines (53 loc) · 1.82 KB
/
choose.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
<?php
/**
* Coding Pirates Teaminator
* Used to generate teams at Coding Pirates Game Jam 2015-2016
*/
include("header.php");
if(isset($_REQUEST['submit'])) {
// now find the data
$visualprog = isset($_REQUEST['visualprog']) ? 1 : 0;
$textprog = isset($_REQUEST['textprog']) ? 1 : 0;
$graphic = isset($_REQUEST['graphic']) ? 1 : 0;
if (!$visualprog && !$textprog && !$graphic) {
echo "Husk at vælge interesser!";
} else {
$update_sql = "UPDATE participants SET visualprog=:visualprog, textprog=:textprog, graphic=:graphic, updated_since_csv=1 WHERE ID=:ID";
$values = [
[":visualprog",$visualprog],
[":textprog",$textprog],
[":graphic",$graphic],
[":ID",$_REQUEST['names_select']]
];
$db->query($update_sql,$values);
echo "Opdateret<br />";
}
}
$fetch_names_sql = "SELECT ID, name FROM participants WHERE teaminated=0 AND updated_since_csv=0";
$names = $db->query($fetch_names_sql);
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" class="names">
<select name="names_select" class="names_select">
<?php
foreach($names as $name) {
echo "<option value='" . $name['ID'] . "'>" . $name['name'] . "</option>";
}
?>
</select>
<br />
<label for="visualprog">Visuel programmering</label>
<input type="checkbox" name="visualprog" value="visualprog" /><br />
<label for="textprog">Tekstprogrammering</label>
<input type="checkbox" name="textprog" value="textprog" /><br />
<label for="graphic">Grafik / game design</label>
<input type="checkbox" name="graphic" value="graphic" /><br />
<button type="submit" name="submit" class="btn btn-default btn-block">Opdater interesser</button>
</form>
<script>
$(document).ready(function() {
$(".names_select").select2();
});
</script>
<?php
include("footer.php");
?>