2024-09-25 15:40:03 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
global $connection;
|
2024-09-26 11:16:27 +00:00
|
|
|
|
2024-09-25 15:40:03 +00:00
|
|
|
if ($_SERVER ["REQUEST_METHOD"] === "POST") {
|
|
|
|
|
|
|
|
require "assets/database.php";
|
|
|
|
|
|
|
|
$sgl = "INSERT INTO student (first_name, second_name, age, life, college)
|
2024-09-26 07:08:30 +00:00
|
|
|
VALUES (?, ?, ?, ?, ?)";
|
2024-09-26 11:16:27 +00:00
|
|
|
|
|
|
|
$statement = mysqli_prepare($connection, $sgl);
|
|
|
|
|
|
|
|
if ($statement === false) {
|
|
|
|
echo mysqli_error($connection);
|
|
|
|
} else {
|
|
|
|
mysqli_stmt_bind_param($statement, "ssiss", $_POST["first_name"], $_POST["second_name"], $_POST["age"], $_POST["life"], $_POST["college"]);
|
|
|
|
|
|
|
|
if (mysqli_stmt_execute($statement)) {
|
|
|
|
$id = mysqli_insert_id($connection);
|
|
|
|
echo "Úspěšně vložen žák s ID: $id";
|
|
|
|
} else {
|
|
|
|
echo mysgli_stmt_error($statement);
|
|
|
|
}
|
|
|
|
}
|
2024-09-25 15:40:03 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="cs">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>Document</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<?php require "assets/header.php" ?>
|
|
|
|
|
|
|
|
<main>
|
|
|
|
<section class="add-form">
|
|
|
|
<form action="pridat-zaka.php" method="POST">
|
|
|
|
<input type="text" name="first_name" placeholder="Křestní jméno">
|
|
|
|
<br>
|
|
|
|
<input type="text" name="second_name" placeholder="Příjmení">
|
|
|
|
<br>
|
|
|
|
<input type="number" name="age" placeholder="Věk" min="10">
|
|
|
|
<br>
|
|
|
|
<textarea name="life" placeholder="Podrobnosti o žákovi"></textarea>
|
|
|
|
<br>
|
|
|
|
<input type="text" name="college" placeholder="Kolej">
|
|
|
|
<br>
|
|
|
|
<input type="submit" value="Přidat žáka">
|
|
|
|
</form>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
</main>
|
|
|
|
|
|
|
|
|
|
|
|
<?php require "assets/footer.php" ?>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|