Initial commit from online.
This commit is contained in:
46
admin/inhalte/gb/edit.php
Normal file
46
admin/inhalte/gb/edit.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<h3>Gästebucheintrag ändern</h3>
|
||||
|
||||
<?php
|
||||
if (!isset($_POST['Speichern'])) {
|
||||
echo "<img src=\"../img/umgebung/gb/".$_POST['Titel'].".jpg\" /><br />";
|
||||
$sql1 = 'SELECT Autor, Text, Datum FROM gb WHERE ID = "'.$_POST['Titel'].'"';
|
||||
$result1 = $db->query($sql1);
|
||||
$nt1 = $result1->fetch_assoc();
|
||||
|
||||
?>
|
||||
|
||||
<form action="index.php?section=gb" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="edit" value="speichern" />
|
||||
<input type="hidden" name="id" value="<?php echo $_POST['Titel']; ?>" />
|
||||
<label>Autor</label>
|
||||
<br />
|
||||
<input type="text" name="Autor" value="<?php echo $nt1['Autor']; ?>" />
|
||||
<br />
|
||||
<label>Text</label>
|
||||
<br />
|
||||
<textarea name="Text" cols="90" rows="10"><?php echo $nt1['Text']; ?></textarea>
|
||||
<br />
|
||||
<label>Datum (YYYY-MM-TT)</label>
|
||||
<br />
|
||||
<input type="text" name="Datum" value="<?php echo $nt1['Datum']; ?>" />
|
||||
<input type="submit" name="Speichern" value="Speichern" />
|
||||
</form>
|
||||
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
$Autor = $_POST['Autor'];
|
||||
$Text = $_POST['Text'];
|
||||
$Datum = $_POST['Datum'];
|
||||
$sql2 = 'UPDATE gb SET Autor = "'.$Autor.'", Text = "'.$Text.'", Datum = "'.$Datum.'" WHERE ID = "'.$_POST['id'].'";';
|
||||
$stmt2 = $db->prepare($sql2);
|
||||
if (!$stmt2) {
|
||||
die ('Es konnte kein SQL-Query vorbereitet werden: '.$db->error);
|
||||
}
|
||||
if (!$stmt2->execute()) {
|
||||
die ('Query konnte nicht ausgeführt werden: '.$stmt->error);
|
||||
}
|
||||
echo "Der Eintrag wurde geändert<br />";
|
||||
echo '<a href="index.php?section=gb">Zurück zur Übersicht</a>';
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user