Files
homepage/admin/inhalte/kal/saison/add.php
2023-12-28 12:13:55 +01:00

44 lines
1.1 KiB
PHP
Raw Blame History

<h3>Neuen Zeitraum hinzufügen</h3>
<?php
if (!isset($_POST['Speichern'])) {
$sql2 = "SELECT Typ FROM Saison_Typ ORDER BY ID";
$result2 = $db->query($sql2);
?>
<form action="index.php?section=kal&t=saison" method="post" enctype="multipart/form-data">
<input type="hidden" name="add" value="speichern" />
<label>Von (YYYY-MM-TT):</label>
<input type="text" name="Von" />
<br />
<label>Bis (YYYY-MM-TT):</label>
<input type="text" name="Bis" />
<br />
<label>Saisontyp:</label>
<select name="Typ">
<?php
while ($nt2 = $result2->fetch_assoc()) {
echo "<option>".$nt2['Typ']."</option>";
}
?>
</select>
<br />
<input type="submit" name="Speichern" value="Speichern" />
</form>
<?php
}
else {
$sql1 = 'INSERT INTO Saison (ID, Von, Bis, Typ) VALUES (NULL, "'.$_POST['Von'].'", "'.$_POST['Bis'].'", "'.$_POST['Typ'].'");';
$stmt1 = $db->prepare($sql1);
if (!$stmt1) {
die ('Es konnte kein SQL-Query vorbereitet werden: '.$db->error);
}
if (!$stmt1->execute()) {
die ('Query konnte nicht ausgef<65>hrt werden: '.$stmt1->error);
}
echo '<a href="index.php?section=kal&t=saison">Zur<75>ck zur <20>bersicht</a>';
}
?>