-
Notifications
You must be signed in to change notification settings - Fork 1
/
teaminator-add-manual.php
45 lines (40 loc) · 1.54 KB
/
teaminator-add-manual.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
<?php
/**
* Coding Pirates Teaminator
* Used to generate teams at Coding Pirates Game Jam 2015-2016
*/
include("header.php");
if(isset($_REQUEST['submit'])) {
// Form already filled out
$sql = "INSERT INTO participants
(name,age,visualprog,textprog,graphic,updated_since_csv,teaminated)
VALUES (:name, :age, :visualprog, :textprog, :graphic, true, false)";
// if statements determining whether the interests should be true or false
$visualprog = isset($_REQUEST['visualprog']) ? 1 : 0;
$textprog = isset($_REQUEST['textprog']) ? 1 : 0;
$graphic = isset($_REQUEST['graphic']) ? 1 : 0;
// make array with list of values
$values = [
[":name", $_REQUEST['name']],
[":age", $_REQUEST['age']],
[":visualprog", $visualprog],
[":textprog", $textprog],
[":graphic", $graphic]
];
$db->query($sql,$values);
echo $_REQUEST['name'] . " er oprettet!";
}
?>
<h2>KUN hvis du har brug for at tilføje en person manuelt af en eller anden grund. Ellers brug CSV upload!</h2>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Navn: <input type="text" name="name" /><br />
Alder <input type="number" name="age" /><br />
Interesser: <br />
Visuel programmering: <input type="checkbox" name="visualprog" value="visualprog" /><br />
Tekstprogrammering: <input type="checkbox" name="textprog" value="textprog" /><br />
Grafik / game design: <input type="checkbox" name="graphic" value="graphic" /><br /><br />
<input type="submit" name="submit" value="Bliv Team-inated!" />
</form>
<?php
include("footer.php");
?>