Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <?php
- //connect to database
- @ $db= new mysqli('localhost','root','','assessment1');
- if (mysqli_connect_error())
- {//display the details of any connection errors
- echo 'Error connecting to database:<br/>'.mysqli_connect_error();
- exit;
- }
- ?>
- <html>
- <head>
- <title>Increase Duration Page</title>
- <!-- <script language="JavaScript" type="text/javascript">
- function ValidateForm()
- {
- //validate for Duration
- if (document.newEventDuration.Duration.value == '')
- {
- alert('Duration field cannot be blank.');
- document.newEventDuration.Duration.focus();
- return false;
- }
- ///Tests if the Duration have the length from 3 to 12
- if (document.newEventDuration.value.length <=3) && (document.newEventDuration.value.length >=12)
- {
- alert('Duration value must be from 3 to 12 ');
- document.newEventDuration.Duration.focus();
- return false;
- }
- }
- </script> -->
- </head>
- <body>
- <?php
- $query = "SELECT * FROM time_slot";
- $results = $db-> query($query);
- $count = ($results->num_rows) < 3 ? '1' : (($results->num_rows) / 3);
- ?>
- <form name="newEventDuration" method="post" action="process.php">
- <table style="width: 300px; border: 0px;" cellspacing="1" cellpadding="1">
- <tr>
- <td colspan="2"><strong>Event Duration</strong></td>
- </tr>
- <tr style="background-color: #FFFFFF;">
- <td>Length Event Duration</td>
- <td>
- <input name="duration" type="number" style="width: 50px;" maxlength="2" min="<?php echo $count; ?>" max="12" value="<?php echo $count; ?>" required/>*</td>
- </tr>
- <tr style="background-color: #FFFFFF;">
- <td>
- <input type="submit" name="submit" value="Submit" /></td>
- </tr>
- </table>
- <br>
- <!--<button onclick="goBack()">Go Back</button>-->
- <a href="http://localhost:2431/csg2431/Assignment/VolunteerTimeSlots.php">Back</a>
- <?php echo '<p><a href="logout.php">Log Out</a></p>'; ?>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement