Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.57 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src="ajax.js"> </script>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6. <style>
  7. tbody:nth-child(odd){border:solid steelblue 1px;}
  8. table{background-color:gold;display:inline-block;}
  9. tr:nth-child(odd){background-color:steelblue;}
  10. .sortable tr:nth-child(even){background-color:red;}
  11. table{margin-left:5px;}
  12. td{color:black;padding:2px;height:25%;max-height:15px;}
  13. .input{max-width:99px;}
  14. #description{width:300px;}
  15. #sidebar{display:inline-block;float:left;}
  16. button{height:24px;width:145px;}
  17. #addshop{margin-left:5px;width:154px;height:30px;background-color:steelblue;color:black;box-shadow:inset 1px 0px 5px #000000;text-align:center;border-radius:5px;text-shadow:0px 1px .5px rgba(204, 204, 204, .46);font: 25.3333px Arial;cursor:default;}
  18. #addshop:hover{background-color:gold;transition:all .1s;}
  19. #addshop:hover:active{background-color:gold;transition:all .1s;box-shadow:1px 0px 5px #000000;}
  20. #content{margin-left:5px;}
  21.  
  22. </style>
  23.  
  24. <script>
  25. function addItem(){};
  26.  
  27. function addShop(sname){
  28.     var shops = document.getElementByID("buttonbar").innerHTML;
  29.     var newshop = shops + "<tr><td><button>"+sname+"</button></td></tr>";
  30.    
  31. };
  32. </script>
  33.  
  34. </head>
  35. <body>
  36.  
  37. <div id="sidebar">
  38. <table>
  39. <div id="buttonbar">
  40. <tr><td><button onclick="updateTable('football')">Italian Sausage</button></td></tr>
  41. <tr><td><button onclick="updateTable('soccer')">Backyard Barbeque</button></td></tr>
  42. <tr><td><button onclick="updateTable('concert')">Champion Bar & Grill</button></td></tr>
  43. <tr><td><button onclick="updateTable('event')">Market Fresh Deli</button></td></tr>
  44. <tr><td><button onclick="updateTable('football')">Smokehouse Grill</button></td></tr>
  45. <tr><td><button onclick="updateTable('football')">Stadium Pizza</button></td></tr>
  46. <tr><td><button onclick="updateTable('football')">Tailgate Grill</button></td></tr>
  47. <tr><td><button onclick="updateTable('football')">Tenders & Wings</button></td></tr>
  48. <tr><td><button onclick="updateTable('football')">Berkshire Sausage</button></td></tr>
  49. <tr><td><button onclick="updateTable('football')">East Boards</button></td></tr>
  50. <tr><td><button onclick="updateTable('football')">Center Boards</button></td></tr>
  51. <tr><td><button onclick="updateTable('football')">West Boards</button></td></tr>
  52. <tr><td><button onclick="updateTable('football')">Pavilion</button></td></tr>
  53. <tr><td><button onclick="updateTable('football')">Optum</button></td></tr>
  54. </div>
  55. </table>
  56. <div id="addshop">
  57. ADD NEW
  58. </div>
  59. <div id="debugbox" style="float:left;"></div>
  60. </div>
  61.  
  62. <?php
  63.  
  64. function pickTable($n){
  65.     $name = $n;
  66.     return $name;
  67. }
  68.  
  69. $servername = "localhost";
  70. $username = "warp";
  71. $password = "morowind1";
  72. $dbname = "gillette";
  73.  
  74. // Create connection
  75. $conn = new mysqli($servername, $username, $password, $dbname);
  76. // Check connection
  77. if ($conn->connect_error) {
  78.      die("Connection failed: " . $conn->connect_error);
  79. }
  80.  
  81. echo "";
  82.  
  83. $table = "football";
  84. $standType = "1";
  85. echo "<div id='content' style='display:inline-block;margin-left:5px;'>content placeholder";
  86.  
  87. $sql = "SELECT id, name, description, price, item_type, stand_type FROM ". $table . " WHERE stand_type > 0";
  88. $result = $conn->query($sql);
  89.  
  90. echo "<script src='ajax.js'> </script>";
  91.  
  92.  
  93.     if ($result->num_rows > 0) {
  94.          // output data of each row
  95.          echo "<form><table id='tableData'>";
  96.          $i = 0;
  97.          while($row = $result->fetch_assoc()) {
  98.              $i = $i+1;
  99.              $description = str_replace("'", "&#39", $row["description"]);
  100.              $name = str_replace("'", "&#39", $row["name"]);
  101.              
  102.              echo " <tr id='row".$i."'><td id='itemid'>". $i. " </td>
  103.              <td>Name: <input class='input' id='iname".$i."' type='text' name='iname' value='". $name. "'></input> </td>
  104.              
  105.              <td>-Price:  <input class='input' id='price".$i."' type='text' name='price' value='" . $row["price"] . "'></input> </td>
  106.              
  107.              <td>-Description:  <input class='input' id='description".$i."' type='text' name='description' value='" . $description . "'></input></td>
  108.              <td>-type:  <input class='input' id='type".$i."' type='text' name='type' value='" . $row["item_type"] . "'></input></td>
  109.              <td>-stand:  <input class='input' id='stand".$i."' type='text' name='stand' value='" . $row["stand_type"] . "'></input></td><td><input type='button' value='delete' onclick='delRow()'></td></tr>";
  110.          }
  111.          echo "</table></div><br><input style='margin-left:5px;' type='button' onclick='acceptFunction()' value='submit'><input style='margin-left:5px;' type='button' value='add' onclick='newRow()'></form>";
  112.          
  113.     } else {
  114.          echo "0 results";
  115.     }
  116.  
  117.  
  118. $conn->close();
  119.  
  120. ?>  
  121.  
  122. </body>
  123. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement