Advertisement
Guest User

form

a guest
Oct 20th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <?php
  3. //connect to database
  4. @ $db= new mysqli('localhost','root','','assessment1');
  5. if (mysqli_connect_error())
  6. {//display the details of any connection errors
  7. echo 'Error connecting to database:<br/>'.mysqli_connect_error();
  8. exit;
  9. }
  10. ?>
  11. <html>
  12. <head>
  13. <title>Increase Duration Page</title>
  14.  
  15. <!-- <script language="JavaScript" type="text/javascript">
  16. function ValidateForm()
  17. {
  18. //validate for Duration
  19. if (document.newEventDuration.Duration.value == '')
  20. {
  21. alert('Duration field cannot be blank.');
  22. document.newEventDuration.Duration.focus();
  23. return false;
  24. }
  25. ///Tests if the Duration have the length from 3 to 12
  26. if (document.newEventDuration.value.length <=3) && (document.newEventDuration.value.length >=12)
  27. {
  28. alert('Duration value must be from 3 to 12 ');
  29. document.newEventDuration.Duration.focus();
  30. return false;
  31. }
  32.  
  33. }
  34. </script> -->
  35. </head>
  36.  
  37. <body>
  38. <?php
  39. $query = "SELECT * FROM time_slot";
  40. $results = $db-> query($query);
  41. $count = ($results->num_rows) < 3 ? '1' : (($results->num_rows) / 3);
  42. ?>
  43. <form name="newEventDuration" method="post" action="process.php">
  44. <table style="width: 300px; border: 0px;" cellspacing="1" cellpadding="1">
  45. <tr>
  46. <td colspan="2"><strong>Event Duration</strong></td>
  47. </tr>
  48. <tr style="background-color: #FFFFFF;">
  49. <td>Length Event Duration</td>
  50. <td>
  51. <input name="duration" type="number" style="width: 50px;" maxlength="2" min="<?php echo $count; ?>" max="12" value="<?php echo $count; ?>" required/>*</td>
  52. </tr>
  53.  
  54. <tr style="background-color: #FFFFFF;">
  55. <td>
  56. <input type="submit" name="submit" value="Submit" /></td>
  57. </tr>
  58. </table>
  59. <br>
  60. <!--<button onclick="goBack()">Go Back</button>-->
  61. <a href="http://localhost:2431/csg2431/Assignment/VolunteerTimeSlots.php">Back</a>
  62. <?php echo '<p><a href="logout.php">Log Out</a></p>'; ?>
  63. </form>
  64. </body>
  65. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement