mirror of
https://github.com/JannikKoester/Tischverwaltung.git
synced 2026-01-09 14:20:08 +01:00
code gekürzt
This commit is contained in:
120
index.php
120
index.php
@@ -24,71 +24,8 @@
|
||||
<?php
|
||||
if (isset($_GET['result'])) {
|
||||
if ($_GET['result'] == "gotrecords" || $_GET['result'] == "loggedin") {
|
||||
$selectedjan = '';
|
||||
$selectedfeb = '';
|
||||
$selectedmar = '';
|
||||
$selectedapr = '';
|
||||
$selectedmai = '';
|
||||
$selectedjun = '';
|
||||
$selectedjul = '';
|
||||
$selectedaug = '';
|
||||
$selectedsep = '';
|
||||
$selectedokt = '';
|
||||
$selectednov = '';
|
||||
$selecteddez = '';
|
||||
|
||||
switch ($_SESSION["month_string"]) {
|
||||
|
||||
case "Januar":
|
||||
$selectedjan = 'selected';
|
||||
break;
|
||||
|
||||
case "Februar":
|
||||
$selectedfeb = 'selected';
|
||||
break;
|
||||
|
||||
case "März":
|
||||
$selectedmar = 'selected';
|
||||
break;
|
||||
|
||||
case "April":
|
||||
$selectedapr = 'selected';
|
||||
break;
|
||||
|
||||
case "Mai":
|
||||
$selectedmai = 'selected';
|
||||
break;
|
||||
|
||||
case "Juni":
|
||||
$selectedjun = 'selected';
|
||||
break;
|
||||
|
||||
case "Juli":
|
||||
$selectedjul = 'selected';
|
||||
break;
|
||||
|
||||
case "August":
|
||||
$selectedjaug = 'selected';
|
||||
break;
|
||||
|
||||
case "September":
|
||||
$selectedsep = 'selected';
|
||||
break;
|
||||
|
||||
case "Oktober":
|
||||
$selectedokt = 'selected';
|
||||
break;
|
||||
|
||||
case "November":
|
||||
$selectednov = 'selected';
|
||||
break;
|
||||
|
||||
case "Dezember":
|
||||
$selecteddez = 'selected';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//DROPDOWN JAHRE
|
||||
echo '<form action="getTables.php" method="post">
|
||||
<div class="form-group">
|
||||
<label for="sel1"style="color:white;font-family:Bitter;font-size:24px;">Jahr:</label>
|
||||
@@ -104,26 +41,25 @@
|
||||
|
||||
|
||||
echo '</select>';
|
||||
//DROPDOWN MONATE
|
||||
$monate = array('Januar','Februar','März','April','Mai','Juni','Juli','August',
|
||||
'September','Oktober','November','Dezember');
|
||||
|
||||
echo '<form action="getTables.php" method="post">
|
||||
<div class="form-group">
|
||||
<label for="sel1"style="color:white;font-family:Bitter;font-size:24px;">Monat:</label>
|
||||
<select class="form-control" name="month"onchange="refreshListe()">
|
||||
<option value ="Januar"' . $selectedjan . '>Januar</option>
|
||||
<option value ="Februar"' . $selectedfeb . '>Februar</option>
|
||||
<option value ="März"' . $selectedmar . '>März</option>
|
||||
<option value ="April"' . $selectedapr . '>April</option>
|
||||
<option value ="Mai"' . $selectedmai . '>Mai</option>
|
||||
<option value ="Juni"' . $selectedjun . '>Juni</option>
|
||||
<option value ="Juli"' . $selectedjul . '>Juli</option>
|
||||
<option value ="August"' . $selectedaug . '>August</option>
|
||||
<option value ="September"' . $selectedsep . '>September</option>
|
||||
<option value ="Oktober"' . $selectedokt . '>Oktober</option>
|
||||
<option value ="November"' . $selectednov . '>November</option>
|
||||
<option value ="Dezember"' . $selecteddez . '>Dezember</option>
|
||||
</select>';
|
||||
<select class="form-control" name="month"onchange="refreshListe()">';
|
||||
for ($i=0; $i <12 ; $i++) {
|
||||
if($monate[$i] == $_SESSION["month_string"])
|
||||
{
|
||||
echo ("<option value='$monate[$i]'selected>$monate[$i]</option>");
|
||||
}
|
||||
echo '<option value ='.$monate[$i].'>'.$monate[$i].'</option>';
|
||||
}
|
||||
|
||||
echo '</select>';
|
||||
|
||||
//DROPDOWN TAGE
|
||||
|
||||
echo '<div class="form-group">
|
||||
|
||||
@@ -145,6 +81,7 @@
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
//DROPDOWN JAHRE
|
||||
echo '<form action="getTables.php" method="post">
|
||||
<div class="form-group">
|
||||
<label for="sel1"style="color:white;font-family:Bitter;font-size:24px;">Jahr:</label>
|
||||
@@ -158,25 +95,24 @@
|
||||
}
|
||||
}
|
||||
echo '</select>';
|
||||
//DROPDOWN MONATE
|
||||
$monate = array('Januar','Februar','März','April','Mai','Juni','Juli','August',
|
||||
'September','Oktober','November','Dezember');
|
||||
|
||||
echo '<form action="getTables.php" method="post">
|
||||
<div class="form-group">
|
||||
<label for="sel1"style="color:white;font-family:Bitter;font-size:24px;">Monat:</label>
|
||||
<select class="form-control" name="month"onchange="refreshListe()">
|
||||
<option value ="Januar">Januar</option>
|
||||
<option value ="Februar">Februar</option>
|
||||
<option value ="März">März</option>
|
||||
<option value ="April">April</option>
|
||||
<option value ="Mai">Mai</option>
|
||||
<option value ="Juni">Juni</option>
|
||||
<option value ="Juli">Juli</option>
|
||||
<option value ="August">August</option>
|
||||
<option value ="September">September</option>
|
||||
<option value ="Oktober">Oktober</option>
|
||||
<option value ="November">November</option>
|
||||
<option value ="Dezember">Dezember</option>
|
||||
</select>';
|
||||
<select class="form-control" name="month"onchange="refreshListe()">';
|
||||
for ($i=0; $i <12 ; $i++) {
|
||||
if($monate[$i] == $_SESSION["month_string"])
|
||||
{
|
||||
echo ("<option value='$monate[$i]'selected>$monate[$i]</option>");
|
||||
}
|
||||
echo '<option value ='.$monate[$i].'>'.$monate[$i].'</option>';
|
||||
}
|
||||
|
||||
echo '</select>';
|
||||
//DROPDOWN JAHRE
|
||||
echo '<div class="form-group">
|
||||
|
||||
<label for="sel1"style="color:white;font-family:Bitter;font-size:24px;">Tag:</label>
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
|
||||
$("#refresh").click();
|
||||
}
|
||||
function ValidInputs(){
|
||||
//var daystart = $( "#daystart:selected" ).text();
|
||||
alert("daystart");
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
104
test.php
104
test.php
@@ -1,92 +1,24 @@
|
||||
<!-- Modals für erstes belegen Mehrfachauswahl-->
|
||||
<div class="container">
|
||||
|
||||
<!-- The Modal Tisch 1 -->
|
||||
<form action="insertEntry.php" method="post">
|
||||
<div class="modal" id="myModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<!-- Modal Header -->
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Tisch 1 neu</h4>
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
</div>
|
||||
|
||||
<!-- Modal body -->
|
||||
<div class="modal-body">
|
||||
<form action="getTables.php" method="post">
|
||||
<h2>Geben Sie Ihren Namen ein:</h2>
|
||||
<label for="lname">Name:</label>
|
||||
<input type="text" id="lname" name="reservierterName"required><br><br>
|
||||
|
||||
<?php
|
||||
echo '<h3>Reservieren von</h3>';
|
||||
echo '<select class="form-control" name="daystart" id="daystart" onchange="ValidInputs()">';
|
||||
for ($i=1; $i <32 ; $i++) {
|
||||
$month = $_SESSION['month_string'];
|
||||
if ($i == 1) {
|
||||
echo "<option value='$i' selected>$i. $month</option>";
|
||||
} else {
|
||||
echo "<option value ='$i'> $i. $month</option>";
|
||||
/*
|
||||
for ($i=0; $i <12 ; $i++) {
|
||||
echo $monate[$i]."\n";
|
||||
}
|
||||
*/
|
||||
$monate = array('Januar','Februar','März','April','Mai','Juni','Juli','August',
|
||||
'September','Oktober','November','Dezember');
|
||||
|
||||
echo '<form action="getTables.php" method="post">
|
||||
<div class="form-group">
|
||||
<label for="sel1"style="color:white;font-family:Bitter;font-size:24px;">Monat:</label>
|
||||
<select class="form-control" name="month"onchange="refreshListe()">';
|
||||
for ($i=0; $i <12 ; $i++) {
|
||||
if($monate[$i] == $_SESSION["month_string"])
|
||||
{
|
||||
echo '<option value ='.$monate[$i].'selected>'.$monate[$i].'</option>';
|
||||
}
|
||||
echo '<option value ='.$monate[$i].'>'.$monate[$i].'</option>';
|
||||
}
|
||||
|
||||
}
|
||||
echo '</select>';
|
||||
echo '<h3>bis</h3>';
|
||||
echo '<select class="form-control" name="dayend" id="dayend" onchange="ValidInputs()">';
|
||||
for ($i=1; $i <32 ; $i++) {
|
||||
$month = $_SESSION['month_string'];
|
||||
if ($i == 1) {
|
||||
echo "<option value='$i' selected>$i. $month</option>";
|
||||
} else {
|
||||
echo "<option value ='$i'> $i. $month</option>";
|
||||
}
|
||||
|
||||
}
|
||||
echo '</select>';
|
||||
|
||||
?>
|
||||
<br>
|
||||
|
||||
|
||||
<input class="btn btn-primary" type="submit" id="reservierenbutton"value="Reservieren" name="reservierenBtnTisch1" >
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Modal footer -->
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
if(isset($_POST['reservierenBtnTisch1'])){
|
||||
$month = $_SESSION["month"];
|
||||
$daystart=intval($_POST['daystart']);
|
||||
$dayend = intval($_POST['dayend']);
|
||||
$name = $_POST['reservierterName'];
|
||||
$year = $_SESSION["year"];
|
||||
$table = 1;
|
||||
|
||||
|
||||
|
||||
for ($daystart; $daystart <= $dayend ; $daystart++) {
|
||||
|
||||
$sql = "INSERT INTO calenderplanner (year, month, day,reserviert,reserviertvon,tisch)
|
||||
VALUES ('$year', '$month', '$daystart', '1', '$name', '$table')";
|
||||
$conn->query($sql);
|
||||
|
||||
|
||||
}
|
||||
$_SESSION["sucessmessage"] = '<div class="alert alert-success">
|
||||
Du hast den Tisch erfolgreich reserviert.</div>';
|
||||
header("location:index.php");
|
||||
}
|
||||
Reference in New Issue
Block a user