Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- SESSION_START();
- $db = new PDO('sqlite:./it_stock.sqlite');
- if($_GET["create"] == "stepOne"){
- ?>
- <!-- begin to create new entry -->
- <form action="?id=<?php echo $_GET["id"]; ?>&create=stepTwo" method="post">
- <button name="action_bNew">Neu</button>
- </form>
- <!---->
- <?php
- //##########table (borrowed)##########//
- echo "<table class=\"sortable\">";
- //head
- echo "<thead><tr>";
- echo "<th>Anzahl</th>";
- echo "<th>Name</th>";
- echo "<th>Von</th>";
- echo "<th>Bis</th>";
- echo "<th>Status</th>";
- echo "</tr></thead>";
- //body
- echo "<tbody>";
- foreach($db->query("SELECT * FROM db_borrowed WHERE id_db_inventory='".$_SESSION["id"]."'") as $row) {
- echo "<tr>";
- echo "<td>".$row["amount"]."</td>";
- echo "<td>".$row["name"]."</td>";
- echo "<td>".$row["from_date"]."</td>";
- echo "<td>".$row["to_date"]."</td>";
- echo "<td>".$row["status"]."</td>";
- echo "</tr>";
- }
- echo "</tbody>";
- //foot
- echo "<tfoot>";
- //no content
- echo "</tfoot>";
- echo "</table>";
- //##########table (borrowed)##########//
- ?>
- <br>
- <br>
- <?php
- }
- if($_GET["create"] == "stepTwo"){
- ?>
- <!-- create a new entry -->
- <form action="?id=<?php echo $_GET["id"]; ?>&create=stepThree" method="post">
- <b>Name </b>
- <input type="text" size="20" name="name_b">
- <br>
- <b>Anzahl </b>
- <input type="text" size="5" name="amount_b">
- <br>
- <b>Anmerkung </b>
- <input type="text" size="25" name="notice_b">
- <br>
- <br>
- <button name="action_bCreate">Erstellen</button>
- </form>
- <!---->
- <!-- one page back -->
- <br>
- <br>
- <form action="?id=<?php echo $_GET["id"]; ?>&create=stepOne" method="post">
- <button name="back_bOne">Zurück</button>
- </form>
- <!---->
- <?php
- }
- $name_ab = $_POST["name_b"];
- SESSION_START();
- if($_GET["create"] == "stepFour"){
- echo "$name_ab";
- if($_POST["action_bConfirm"] == "submit"){
- // $stmt = $db->prepare("INSERT INTO db_inventory(id_db_inventory, name, from_date, to_date, amount) VALUES(?,?,?,?,?)");
- // $stmt->bindParam(1, $a);
- // $stmt->bindParam(2, $b);
- // $stmt->bindParam(3, $c);
- // $stmt->bindParam(4, $d);
- // $stmt->bindParam(5, $e);
- // $a = $_SESSION["amount_c1"];
- // $b = $_SESSION["object_c1"];
- // $stmt->execute();
- echo "Das Objekt wurde ausgeliehen.";
- }
- if($_POST["action_bConfirm"] == "decline"){
- echo "Ausleih-Vorgang abgebrochen.";
- }
- ?>
- <?php
- }
- if($_GET["create"] == "stepThree"){
- echo "$name_ab";
- ?>
- <form action="?id=<?php echo $_GET["id"]; ?>&create=stepFour" method="post">
- <b>Wirklich erstellen?</b>
- <br>
- <button name="action_bConfirm" value="submit">Erstellen</button>
- <button name="action_bConfirm" value="decline">Abbrechen</button>
- </form>
- <!-- one page back -->
- <br>
- <br>
- <form action="?id=<?php echo $_GET["id"]; ?>&create=stepTwo" method="post">
- <button name="back_bOne">Zurück</button>
- </form>
- <!---->
- <?php
- }
- $db = NULL;
- ?>
- <!-- back to main menu -->
- <form action="index.php" method="post">
- <?php if($_GET["create"] == "stepThree"){
- die();
- } ?>
- <button name="back_bMenu">Zurück zum Hauptmenü</button>
- </form>
- <!---->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement