-
Notifications
You must be signed in to change notification settings - Fork 0
/
pridat-zaka.php
70 lines (49 loc) · 2.03 KB
/
pridat-zaka.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
<?php
require "assets/database.php"; // odkaz na soubor database.php, ve kterém je uložená proměnná $connection
require "assets/zak.php"; // požaduji soubor zak.php s funkcí pro přidání žáka do databáze
$first_name = null;
$second_name = null;
$age = null;
$life = null;
$college = null;
if ($_SERVER["REQUEST_METHOD"] === "POST") { // POST = OBSAH FORMULÁŘE HTML
$first_name = $_POST["first_name"]; // vyplním pole formuláře skutečnými hodnotami
$second_name = $_POST["second_name"];
$age = $_POST["age"];
$life = $_POST["life"];
$college = $_POST["college"];
$connection = connectionDB(); // připojím se k databázi
createStudent($connection, $first_name, $second_name, $age, $life, $college);
}
?>
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="František Belay" />
<meta name="contact" content="frabel@volny.cz" />
<meta http-equiv="X-UA-Compatible" content="ie-edge" />
<meta name="description" content="Stránka pro přidání žáka do databáze" />
<link rel="stylesheet" href="./css/general.css">
<link rel="stylesheet" href="./css/header.css" />
<link rel="stylesheet" href="./query/header-query.css">
<link rel="stylesheet" href="./css/pridat-zaka.css">
<link rel="stylesheet" href="./css/footer.css">
<link rel="stylesheet" href="./css/footer.css">
<script src="https://kit.fontawesome.com/fc1864d9f1.js" crossorigin="anonymous"></script>
<title>Document</title>
</head>
<body>
<?php require "assets/header.php";?>
<main>
<section class="add-form">
<?php require "assets/formular-zak.php";?> <!-- požaduju tady formulář -->
</section>
<br>
<a href="index.php">Zpět na hlavní stránku.</a>
</main>
<?php require "assets/footer.php";?>
<script language="javascript" src="./js/header.js"></script>
</body>
</html>