-
Notifications
You must be signed in to change notification settings - Fork 1
/
teaminator-add-manual.php
51 lines (46 loc) · 1.79 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
46
47
48
49
50
51
<?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,gender,visualprog,textprog,graphic,updated_since_csv,teaminated)
VALUES (:name, :age, :gender, :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']],
[":gender", $_REQUEST['gender']],
[":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 />
Køn:
<input type="radio" id="male" name="gender" value="m">
<label for="male">Dreng</label>
<input type="radio" id="female" name="gender" value="f">
<label for="female">Pige</label><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");
?>