This commit is contained in:
2025-07-03 11:49:18 +02:00
parent 4e88e4c571
commit 742c2b0160
10 changed files with 112 additions and 59 deletions

View File

@@ -0,0 +1,43 @@
<?php
include dirname(__DIR__).'/header.phtml';
?>
<h2>Neuer Kurs</h2>
<form method="post" class="form-grid">
<?php
$index = 0;
foreach ($labels as $key => $value) {
$hasError = isset($errors[$key]);
$errorClass = $hasError ? ' error' : '';
echo '<div class="input">';
echo '<label for="' . $key . '">' . $value . '</label>';
if ($key == "beschreibung") {
echo '<textarea id="' . $key . '" name="' . $key . '" class="' . $errorClass . '">';
if (isset($validData[$key])) {
echo $validData[$key];
}
echo '</textarea>';
} else {
echo '<input class="' . $errorClass . '" type="text" name="' . $key . '" value="' . (isset($validData[$key]) ? $validData[$key] : '') . '">';
}
if ($hasError) {
echo '<p class="error">' . $errors[$key] . '</p>';
}
echo '</div>';
$index++;
}
?>
<input type="hidden" name="controller" value="admin">
<input type="hidden" name="do" value="validateForm">
<input type="submit" name="submit" value="Absenden"></form>
<?php include dirname(__DIR__).'/footer.phtml'; ?>

View File

@@ -0,0 +1,12 @@
<?php
include dirname(__DIR__).'/header.phtml';
?>
<div class="msg">
<p>Kurs erfolgreich erstellt.</p>
<a href="?controller=Welcome&do=showWelcome">Weiter</a>
</div>
<?php include dirname(__DIR__).'/footer.phtml'; ?>

View File

@@ -1,34 +0,0 @@
<?php
include dirname(__DIR__).'/header.phtml';
?>
<h2>Neuer Kurs</h2>
<form method="post" class="form-grid">
<?php
$index = 0;
foreach ($labels as $key => $value) {
echo '<div class="input"><label for="' . $key . '">' . $value . '</label>';
if ($key == "beschreibung") {
echo "<textarea id=\"$key\" name=\"$key\" >";
if (isset($validData[$key])) { echo $validData[$key]; }
echo "</textarea><br>";
} else {
echo '<input class="input" type="text" name="' . $key . '" value="' . (isset($validData[$key]) ? $validData[$key] : '') . '"><br>';
}
if (isset($errors[$key])) {
echo '<label class="errorMsg">' . $errors[$key] . '</label><br>';
}
echo '</div>';
$index++;
}
?>
<input type="hidden" name="controller" value="admin">
<input type="hidden" name="do" value="showForm">
<input type="submit" name="submit" value="Absenden"></form>
<?php include dirname(__DIR__).'/footer.phtml'; ?>