Advertisement
Guest User

$_POST problem

a guest
Aug 18th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.50 KB | None | 0 0
  1.     <?php
  2.             SESSION_START();
  3.             $db = new PDO('sqlite:./it_stock.sqlite');
  4.  
  5.             if($_GET["create"] == "stepOne"){
  6.                 ?>
  7.                 <!-- begin to create new entry -->
  8.                 <form action="?id=<?php echo $_GET["id"]; ?>&amp;create=stepTwo" method="post">
  9.                     <button name="action_bNew">Neu</button>
  10.                 </form>
  11.                 <!---->
  12.                 <?php
  13.  
  14.                 //##########table (borrowed)##########//
  15.                 echo "<table class=\"sortable\">";
  16.  
  17.                 //head
  18.                 echo  "<thead><tr>";
  19.                 echo "<th>Anzahl</th>";
  20.                 echo "<th>Name</th>";
  21.                 echo "<th>Von</th>";
  22.                 echo "<th>Bis</th>";
  23.                 echo "<th>Status</th>";
  24.                 echo "</tr></thead>";
  25.  
  26.                 //body
  27.                 echo "<tbody>";
  28.                 foreach($db->query("SELECT * FROM db_borrowed WHERE id_db_inventory='".$_SESSION["id"]."'") as $row) {
  29.                     echo "<tr>";
  30.                     echo "<td>".$row["amount"]."</td>";
  31.                     echo "<td>".$row["name"]."</td>";
  32.                     echo "<td>".$row["from_date"]."</td>";
  33.                     echo "<td>".$row["to_date"]."</td>";
  34.                     echo "<td>".$row["status"]."</td>";
  35.                     echo "</tr>";
  36.                 }
  37.                 echo "</tbody>";
  38.  
  39.                 //foot
  40.                 echo "<tfoot>";
  41.                 //no content
  42.                 echo "</tfoot>";
  43.  
  44.                 echo "</table>";
  45.                 //##########table (borrowed)##########//
  46.                 ?>
  47.                 <br>
  48.                 <br>
  49.                 <?php
  50.             }
  51.             if($_GET["create"] == "stepTwo"){
  52.                 ?>
  53.                 <!-- create a new entry -->
  54.                 <form action="?id=<?php echo $_GET["id"]; ?>&amp;create=stepThree" method="post">
  55.                     <b>Name &nbsp;</b>
  56.                     <input type="text" size="20" name="name_b">
  57.                     <br>
  58.                     <b>Anzahl &nbsp;</b>
  59.                     <input type="text" size="5" name="amount_b">
  60.                     <br>
  61.                     <b>Anmerkung &nbsp;</b>
  62.                     <input type="text" size="25" name="notice_b">
  63.                     <br>
  64.                     <br>
  65.                     <button name="action_bCreate">Erstellen</button>
  66.                 </form>
  67.                 <!---->
  68.  
  69.                 <!-- one page back -->
  70.                 <br>
  71.                 <br>
  72.                 <form action="?id=<?php echo $_GET["id"]; ?>&amp;create=stepOne" method="post">
  73.                     <button name="back_bOne">Zur&uuml;ck</button>
  74.                 </form>
  75.                 <!---->
  76.                 <?php
  77.  
  78.             }
  79.  
  80. $name_ab = $_POST["name_b"];
  81.  
  82.             SESSION_START();
  83.             if($_GET["create"] == "stepFour"){
  84.                 echo "$name_ab";
  85.                 if($_POST["action_bConfirm"] == "submit"){
  86.                     // $stmt = $db->prepare("INSERT INTO db_inventory(id_db_inventory, name, from_date, to_date, amount) VALUES(?,?,?,?,?)");
  87.                     // $stmt->bindParam(1, $a);
  88.                     // $stmt->bindParam(2, $b);
  89.                     // $stmt->bindParam(3, $c);
  90.                     // $stmt->bindParam(4, $d);
  91.                     // $stmt->bindParam(5, $e);
  92.                     // $a = $_SESSION["amount_c1"];
  93.                     // $b = $_SESSION["object_c1"];
  94.                     // $stmt->execute();
  95.  
  96.  
  97.                     echo "Das Objekt wurde ausgeliehen.";
  98.                 }
  99.                 if($_POST["action_bConfirm"] == "decline"){
  100.                     echo "Ausleih-Vorgang abgebrochen.";
  101.                 }
  102.                 ?>
  103.                 <?php
  104.             }
  105.             if($_GET["create"] == "stepThree"){
  106.                 echo "$name_ab";
  107.                 ?>
  108.                 <form action="?id=<?php echo $_GET["id"]; ?>&amp;create=stepFour" method="post">
  109.                     <b>Wirklich erstellen?</b>
  110.                     <br>
  111.                     <button name="action_bConfirm" value="submit">Erstellen</button>
  112.                     <button name="action_bConfirm" value="decline">Abbrechen</button>
  113.                 </form>
  114.  
  115.                 <!-- one page back -->
  116.                 <br>
  117.                 <br>
  118.                 <form action="?id=<?php echo $_GET["id"]; ?>&amp;create=stepTwo" method="post">
  119.                     <button name="back_bOne">Zur&uuml;ck</button>
  120.                 </form>
  121.                 <!---->
  122.                 <?php
  123.             }
  124.             $db = NULL;
  125.             ?>
  126.  
  127.             <!-- back to main menu -->
  128.             <form action="index.php" method="post">
  129.                 <?php if($_GET["create"] == "stepThree"){
  130.                     die();
  131.                 } ?>
  132.                 <button name="back_bMenu">Zur&uuml;ck zum Hauptmen&uuml;</button>
  133.             </form>
  134.             <!---->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement