Files
homepage/admin/inhalte/preise/view.php

54 lines
2.3 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
if (!isset($_POST['Speichern'])) {
if ('gaby' == $_GET['t']) {
echo "<h2>Preise Wohnung Gaby</h2>";
$sql1 = "SELECT * FROM Preise WHERE ID = 1 ";
} elseif ('amelie' == $_GET['t']) {
echo "<h2>Preise Wohnung Amelie</h2>";
$sql1 = "SELECT * FROM Preise WHERE ID = 2";
} else {
die("Falsche Sektion");
}
echo "<p>Preise bitte mit einem Punkt (.) trennen</p>";
$result1 = $db->query($sql1);
$nt1 = $result1->fetch_assoc();
?>
<div id="preise">
<form action="index.php?section=preise&t=<?php echo $_GET['t']; ?>" method="post">
<input type="hidden" name="ID" value="<?php echo $nt1['ID'] ?>"/>
<label>Kurbeitrag</label>
<input type="text" name="Kurbeitrag" value="<?php echo $nt1['Kurbeitrag'] ?>"/>€
<br/>
<label>Nacht3</label>
<input type="text" name="Nacht3" value="<?php echo $nt1['Nacht3'] ?>"/>€
<br/>
<label>Nacht5</label>
<input type="text" name="Nacht5" value="<?php echo $nt1['Nacht5'] ?>"/>€
<br/>
<label>Hauptsaison</label>
<input type="text" name="Hauptsaison" value="<?php echo $nt1['Hauptsaison'] ?>"/>€
<br/>
<label>Nebensaison</label>
<input type="text" name="Nebensaison" value="<?php echo $nt1['Nebensaison'] ?>"/>€
<br/>
<label>Weihnachten</label>
<input type="text" name="Weihnachten" value="<?php echo $nt1['Weihnachten'] ?>"/>€
<br/>
<input style="width: auto;" type="submit" name="Speichern" value="Speichern"/>
</form>
</div>
<?php
} else {
$sql2 = 'UPDATE Preise SET Kurbeitrag = "' . $_POST['Kurbeitrag'] . '", Nacht3 = "' . $_POST['Nacht3'] . '", Nacht5 = "' . $_POST['Nacht5'] . '", Hauptsaison = "' . $_POST['Hauptsaison'] . '", Nebensaison = "' . $_POST['Nebensaison'] . '", Weihnachten = "' . $_POST['Weihnachten'] . '" 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=preise">Zurück zur Übersicht</a>';
}