Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- !DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta name="robots" content="noindex, nofollow" />
- <title>BMI Task</title>
- <style type="text/css">
- body {
- font-family: Verdana, Arial, Helvetica, sans-serif;
- background-color: bisque;
- }
- .center {
- text-align:center;
- }
- body,td,th {
- color: brown;
- }
- .larger {
- font-size:larger;
- text-align:right;
- }
- table {
- margin-left:auto;
- margin-right:auto;
- }
- .fixed {
- font-family: Courier, monospace;
- white-space: pre;
- background-color:cornsilk;
- }
- </style>
- </head>
- <body>
- <h3 class="center">COA123 - Server-Side Programming</h3>
- <h2 class="center">Individual Coursework - Olympic Cyclists</h2>
- <h1 class="center">Task 1 - BMI (bmi.php)</h1>
- <table>
- <tr>
- <td>
- <div class="fixed">~ __0
- _-\<,_
- (*)/ (*)
- </div>
- </td>
- </tr>
- </table>
- <br />
- <form action="bmi.php" method="get" id="bmi">
- <table border="1">
- <tr>
- <th scope="col">Key</th>
- <th scope="col">Value</th>
- </tr>
- <tr>
- <td><label for="min_weight">Minimum Weight (min_weight)</label></td>
- <td>
- <input name="min_weight" type="text" class="larger" id="min_weight" value="50" size="5" />
- </td>
- </tr>
- <tr>
- <td><label for="max_weight">Maximum Weight (max_weight)</label></td>
- <td><input name="max_weight" type="text" class="larger" id="max_weight" value="90" size="5" /></td>
- </tr>
- <tr>
- <td><label for="min_height">Minimum Height (min_height)</label></td>
- <td><input name="min_height" type="text" class="larger" id="min_height" value="150" size="5" /></td>
- </tr>
- <tr>
- <td><label for="max_height">Maximum Height (max_height)</label></td>
- <td><input name="max_height" type="text" class="larger" id="max_height" value="190" size="5" /></td>
- </tr>
- <tr>
- <td><label for="submit">Submit</label></td>
- <td><input type="submit" name="submit" id="submit" value="Submit" class="larger" /></td>
- </tr>
- </table>
- <table>
- <?php
- $var1 = $_REQUEST['min_height'];
- $var2 = $_REQUEST['max_height'];
- $var3 = $_REQUEST['min_weight'];
- $var4 = $_REQUEST['max_weight'];
- for($height = $var1; $height <= $var2; $height = $height+5){
- echo '<tr>';
- for($weight = $var3; $weight <= $var4; $weight = $weight+5){
- if($height == $var1 || $weight = $var3){
- $newHeight = $height/100;
- echo '<td>'. $weight/($newHeight).'</td>';
- else {
- echo '<td>' . $weight/($newHeight*$newHeight).'</td>';
- }
- echo '</tr>'
- }
- }
- }
- </table>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement