2023-09-11 11:15:39 +02:00
|
|
|
<h1>Nowe dane tabeli działy</h1>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") // Zapisz dane z formularza do bazy [INSERT]
|
|
|
|
{
|
|
|
|
$Nazwa = $_POST['Nazwa'];
|
2023-09-15 13:17:41 +02:00
|
|
|
$query = "INSERT INTO dzialy (Nazwa) values ('".$Nazwa."')";
|
2023-09-11 11:15:39 +02:00
|
|
|
$result = mysqli_query($conn, $query);
|
2023-09-15 13:17:41 +02:00
|
|
|
if ($result) {
|
|
|
|
echo "Poprawnie dodano rekord do bazy";
|
2023-09-18 10:59:59 +02:00
|
|
|
echo '<br><a href="?PAGE=dzialy">Powrót</a>';
|
2023-09-15 13:17:41 +02:00
|
|
|
} else {
|
|
|
|
echo "Błąd dodawania do bazy";
|
|
|
|
}
|
2023-09-11 11:15:39 +02:00
|
|
|
|
|
|
|
} else {
|
|
|
|
echo '<form action="?PAGE=dzialy_dodaj" method="post">
|
|
|
|
<table>
|
|
|
|
<tr><td>Id_dzial</td><td><input type="text" name="Id_dzial" id="Id_dzial" disabled></td></tr>
|
|
|
|
<tr><td>Nazwa</td><td><input type="text" name="Nazwa" id="Nazwa"></td></tr>
|
|
|
|
<tr><td colspan="2" style="text-align: center"><button type="submit">Zapisz</button></td></tr>
|
|
|
|
</table>
|
|
|
|
</form>';}
|
|
|
|
?>
|