Advertisement
HelloDearSir

booking wont show

Apr 1st, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.80 KB | None | 0 0
  1. <?php
  2.  
  3. $db = mysqli_connect("localhost", "root", "root", "c9") or die("QUERY failed". mysqli_error($db));
  4.  
  5. if (isset($_POST['submit'])) {
  6. $student = $_POST['first'];
  7. $last = $_POST['password'];
  8. $phone = $_POST['phonenumber'];
  9. $email = $_POST['email'];
  10. $location = $_POST['location'];
  11. $query = "INSERT INTO booking(first, Last, Phone, email,location) VALUES('$student', '$last', '$phone', '$email', '$location' )";
  12. $results = mysqli_query($db, $query);
  13. //if !$run_query is true then echo this error.
  14. if($results) {
  15. //echo that it worked
  16. echo 'QUERY ok<br />';
  17.  
  18. } else {
  19. //if it fails then do this.
  20. echo 'QUERY failed -- ' . mysqli_error($db) . '<br />';
  21. }
  22. }
  23. ?>
  24.  
  25.  
  26.  
  27. <?php
  28. session_start();
  29. if($_SESSION['login'] != "That GRRRRREAT")
  30.  
  31. {
  32. header('Location: login.php');
  33. exit();
  34. }
  35.  
  36. ?>
  37. <html>
  38. <head> <link rel="stylesheet" a href="book.css">
  39. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3..3.1/jquery"></script></head>
  40. <body>
  41. <ul>
  42.  
  43. <li style="float:right" ><a href="FAQ.html">FAQ</a></li>
  44.  
  45. <li><a href="profilepage.php">profile </a></li>
  46. <li><a href="messages.php">Messages</a></li>
  47. <li ><a href="booking.php">booking </a></li>
  48.  
  49.  
  50. </ul>
  51. <div id= "container">
  52. <div id="form">
  53. <form action="book.php" method="post">
  54. <table>
  55. <tr>
  56. <td align= "right">
  57. First Name:
  58. </td>
  59. <td>
  60. <input size="20px" size="20px" maxlengh="15" type="text" name="first" id="user" onkeyup="check_user()" required>
  61. </td>
  62. </tr>
  63.  
  64. <tr>
  65. <td align = "right">
  66. Last Name:
  67. </td>
  68. <td>
  69. <input size="20px" type="textf" size="20px" maxlengh="15" name="password">&nbsp;
  70.  
  71. </td>
  72.  
  73. <td align= "right">
  74. Email:
  75. </td>
  76. <td>
  77. <input size="20px" size="20px" maxlengh="15" type="text" name="email" id="user" onkeyup="check_user()" required>
  78. </td>
  79. </tr>
  80.  
  81. <tr>
  82. <td align = "right">
  83. Phone number:
  84. </td>
  85. <td>
  86. <input size="20px" type="text" size="20px" maxlengh="15" name="phonenumber">&nbsp;
  87.  
  88. </td>
  89.  
  90.  
  91. </tr>
  92. <tr>
  93. <td align = "right">
  94. Location:
  95. </td>
  96. <td>
  97. <input size="20px" type="textf" size="20px" maxlengh="15" name="location">&nbsp;
  98.  
  99. </td>
  100. </tr>
  101. <td colspan= "2" align="left"> <button type="submit" class="button" name="submit">Add the task</button></td>
  102.  
  103. </div>
  104.  
  105. <table>
  106. <thead>
  107. <tr>
  108.  
  109. <th>&nbsp;</th>
  110. <th class="taskz">Tasks</th>
  111. <th>Done</th>
  112. <th>&nbsp;</th>
  113. </tr>
  114. </thead>
  115.  
  116. <tbody>
  117. <?php
  118. $db = mysqli_connect("localhost", "root", "root", "todo") or die("QUERY failed". mysqli_error($db));
  119. $run_task = mysqli_query($db, "SELECT * FROM booking LIMT 20");
  120. if ($run_task)
  121. {
  122. while ($row = mysql_fetch_assoc($run_task))
  123. {
  124. $id = $row['id'];
  125. $task1 = $row['First'];
  126.  
  127. ?>
  128. <tr>
  129.  
  130. <td>?php echo $id; ?> </td>
  131. <td>?php echo $task1; ?> </td>
  132. <td class = "delete"> <a href="index.php?delete=<?php echo $id;?>"> X</a></td>
  133. </tr>
  134.  
  135.  
  136. <?php } }?>
  137. </tbody>
  138.  
  139. </table>
  140. </div>
  141.  
  142.  
  143. </div>
  144. </body>
  145.  
  146.  
  147.  
  148.  
  149.  
  150. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement