Guest User

Untitled

a guest
Dec 1st, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. <h5>Room Type</h5>
  2.  
  3. <select id="category" name="category" required="">
  4.  
  5. <?php
  6. include 'connect.php';
  7. $room= "SELECT * FROM roomtype";
  8. $resroom = $conn->query($room);
  9. while($roomtype = $resroom->fetch_assoc()){
  10. ?>
  11. <option value="<?php echo $roomtype['roomtype'];?>" ><?php echo $roomtype['roomtype'];?></option>
  12.  
  13. <?php
  14. $max = $roomtype['guests'];
  15. }?>
  16. </select>
  17.  
  18. <h5>Number of Guests *</h5>
  19. <select id="category1" name="guests" required="">
  20. <?php
  21. include 'connect.php';
  22. $inc = 1;
  23. if(isset($_POST))
  24. {
  25. $category = $_POST['category'];
  26. }
  27. $guest = "SELECT * FROM roomtype WHERE roomtype = $category";
  28. $g = $conn->query($guest);
  29. while($guest1 = $g->fetch_assoc()){
  30. while ($guest1 ['guests'] < 0){
  31. ?>
  32. <option value="1"><?php echo $inc; $inc = $inc + 1; }}?></option>
  33. </select>
  34.  
  35. <?php
  36. $servername = "localhost";
  37. $username = "root";
  38. $password = "";
  39. $dbname = "booking";
  40.  
  41. // Create connection
  42. $conn = mysqli_connect($servername, $username, $password, $dbname);
  43.  
  44. // Check connection
  45. if (!$conn) {
  46. die("Connection failed: " . mysqli_connect_error());
  47. }
  48. ?>
Add Comment
Please, Sign In to add comment