2 require 'include/head.inc';
3 require 'include/db.inc';
4 require 'include/common.inc';
6 if(isset($_POST['submit']) && $_POST['mnumber']!="") {
7 $db->query("UPDATE students SET blackboard=blackboard+1 WHERE mnumber=" . trim($_POST['mnumber']));
8 block("lightgreen", "added blackboard");
11 if ($db->query("SELECT COUNT(*) FROM students")->fetch(PDO::FETCH_NUM)[0] == 0) {
12 block("red", "no students registered");
16 block("black", "add blackboard");
19 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
22 <th align="left">Matr.nummer:</th> <th><input type="text" name="mnumber"></th>
23 <th><input type="submit" name="submit" value="Add"></th>
29 block("black", "blackboard overview");
31 $result=$db->query("SELECT firstname, lastname, mnumber, blackboard FROM students");
34 while ($student = $result->fetch(PDO::FETCH_ASSOC)) {
36 print "<td>" . $student['firstname'] . " </td>";
37 print "<td>" . $student['lastname'] . " </td>";
38 print "<td>" . $student['mnumber'] . " </td>";
39 print "<td>" . $student['blackboard'] . "</td>";