Advertisement
Guest User

Untitled

a guest
Sep 1st, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. <form method="post" action="index.php">
  2. <select name="month" id="month">
  3. <option></option>
  4. <option value="1">January</option>
  5. <option value="2">February</option>
  6. <option value="3">March</option>
  7. <option value="4">April</option>
  8. <option value="5">May</option>
  9. <option value="6">June</option>
  10. <option value="7">July</option>
  11. <option value="8">August</option>
  12. <option value="9">September</option>
  13. <option value="10">October</option>
  14. <option value="11">November</option>
  15. <option value="12">December</option>
  16. </select>
  17. <input type="submit" value="submit" name="submit"/>
  18.  
  19. <?php
  20.  
  21. $hostname="localhost";
  22. $username="root";
  23. $password="";
  24. $dbname="testproduct";
  25.  
  26.  
  27. $db = new mysqli($hostname, $username, $password, $dbname);
  28.  
  29.  
  30. $stmt = $db->stmt_init();
  31.  
  32. //
  33. if(!$stmt->bind_param('s', $month)) {
  34. //if BIND fails, display an error
  35. printf("Errormessage: %sn", $stmt->error);
  36. }
  37.  
  38.  
  39. $month = isset($_POST['month'])
  40. ? $db->real_escape_string($_POST['month'])//this 'month' is the select name
  41. : '';
  42.  
  43.  
  44. if(!$stmt->execute()) {
  45. printf("Errormessage: %sn", $stmt->error);
  46. }
  47.  
  48.  
  49. if(!$stmt->bind_result($fname,$lname,$checkin,$checkout,$rrate,$reservefee,$datepaid,$modepayment,$stats))//name of db rows and also the only information I want to show on the web {
  50. printf("Errormessage: %sn", $stmt->error);
  51. }
  52.  
  53.  
  54.  
  55. while($row=$stmt->fetch()) {
  56.  
  57. ?>
  58.  
  59. <tr>
  60. <td><?php echo $row['fname']; ?></td>
  61. <td><?php echo $row['lname']; ?></td>
  62. <td><?php echo $row['checkin']; ?></td>
  63. <td><?php echo $row['checkout']; ?></td>
  64. <td><?php echo $row['rrate']; ?></td>
  65. <td><?php echo $row['reservefee']; ?></td>
  66. <td><?php echo $row['datepaid']; ?></td>
  67. <td><?php echo $row['modepayment']; ?></td>
  68. <td><?php echo $row['stats']; ?></td>
  69. <td align="center">
  70. <a id="<?php echo $row['fname']." ".$row['lname']; ?>" class="edit-link" href="#" title="Edit">
  71. <img src="edit.png" width="20px" />
  72. </a></td>
  73. <td align="center"><a id="<?php echo $row['fname']." ".$row['lname']; ?>" class="delete-link" href="#" title="Delete">
  74. <img src="delete.png" width="20px" />
  75. </a></td>
  76. </tr>
  77. <?php
  78.  
  79. }
  80.  
  81. }
  82.  
  83. ?>
  84. </tbody>
  85. </table>
  86.  
  87. </div>
  88.  
  89. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement