Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <!-- This includes the CSS into the script. -->
- <link href="main.css" rel="stylesheet" type="text/css">
- </head>
- <body>
- <!-- A wrapper is made to keep this content in line with each other. -->
- <div class="wrapper">
- <div class="container">
- <!-- We create a form for the user to select their options -->
- <form role ="form" action="#" method="post">
- <!-- This section is for the MALE -->
- <b>Male Coat</b><br />
- <select name="male-coats">
- <option value="standard">Standard</option>
- <option value="short">Short</option>
- <option value="crested">Crested</option>
- <option value="silk">Silk</option>
- </select>
- </div>
- <!-- This section is for the FEMALE, a seperate container is used to place it next to the male on the webpage -->
- <div class="container">
- <b>Female Coat</b><br />
- <select name="female-coats"> <!-- note that this has a seperate name to the male so that we can find the results below -->
- <option value="standard">Standard</option>
- <option value="short">Short</option>
- <option value="crested">Crested</option>
- <option value="silk">Silk</option>
- </select>
- </div>
- </div>
- <!-- New wrapper is made to post the following content BELOW the stuff above -->
- <div class="wrapper">
- <div class="container">
- <!-- A submit button -->
- <button type="submit" class="btn btn-default">Submit</button>
- </form>
- <?php
- // We are now asking if the submit button has been pressed, if YES then continue
- if ($_SERVER['REQUEST_METHOD'] == 'POST')
- {
- // We want a random number between 1-200 and put it in the variable $check
- $check = rand(1,200);
- //If the male AND female coats standard
- if ($_POST['male-coats'] == 'standard' AND $_POST['female-coats'] == 'standard')
- {
- //make the result also standard
- $coats = 'Standard';
- }
- //If Male is Standard and Female is Short
- elseif ($_POST['male-coats'] == 'standard' AND $_POST['female-coats'] == 'short')
- {
- //check if the random number is more than or equal to 1 AND less than or equal to 151
- if ($check >= 1 AND $check <= 151)
- {
- //if it is, Standard
- $coats = 'Standard';
- }
- //Otherwise if the number is more than 151
- elseif ($check > 151)
- {
- //Short
- $coats = 'Short';
- }
- }
- // We reverse the above to check if the FEMALE is now standard and the MALE is now short, results will be the same
- elseif ($_POST['female-coats'] == 'standard' AND $_POST['male-coats'] == 'short')
- {
- if ($check >= 1 AND $check <= 151)
- {
- $coats = 'Standard';
- }
- elseif ($check > 151)
- {
- $coats = 'Short';
- }
- }
- elseif ($_POST['male-coats'] == 'standard' AND $_POST['female-coats'] == 'crested')
- {
- if ($check >= 1 AND $check <= 130)
- {
- $coats = 'Standard';
- }
- elseif ($check >= 131 AND $check <= 150)
- {
- $coats = 'Short';
- }
- elseif ($check >= 151)
- {
- $coats = 'Crested';
- }
- }
- elseif ($_POST['female-coats'] == 'standard' AND $_POST['male-coats'] == 'crested')
- {
- if ($check >= 1 AND $check <= 130)
- {
- $coats = 'Standard';
- }
- elseif ($check >= 131 AND $check <= 150)
- {
- $coats = 'Short';
- }
- elseif ($check >= 196)
- {
- $coats = 'Crested';
- }
- }
- elseif ($_POST['male-coats'] == 'standard' AND $_POST['female-coats'] == 'silk')
- {
- if ($check >= 1 AND $check <= 150)
- {
- $coats = 'Standard';
- }
- elseif ($check >= 151 AND $check <= 170)
- {
- $coats = 'Short';
- }
- elseif ($check >= 171 AND $check <= 195)
- {
- $coats = 'Crested';
- }
- elseif ($check >= 196)
- {
- $coats = 'Silk';
- }
- }
- elseif ($_POST['female-coats'] == 'standard' AND $_POST['male-coats'] == 'silk')
- {
- if ($check >= 1 AND $check <= 150)
- {
- $coats = 'Standard';
- }
- elseif ($check >= 151 AND $check <= 170)
- {
- $coats = 'Short';
- }
- elseif ($check >= 171 AND $check <= 195)
- {
- $coats = 'Crested';
- }
- elseif ($check >= 196)
- {
- $coats = 'Silk';
- }
- }
- elseif ($_POST['male-coats'] == 'short' AND $_POST['female-coats'] == 'short')
- {
- if ($check >= 1 AND $check <= 140)
- {
- $coats = 'Standard';
- }
- elseif ($check >= 141)
- {
- $coats = 'Short';
- }
- }
- elseif ($_POST['male-coats'] == 'short' AND $_POST['female-coats'] == 'crested')
- {
- if ($check >= 1 AND $check <= 110)
- {
- $coats = 'Standard';
- }
- elseif ($check >= 111 AND $check <= 160)
- {
- $coats = 'Short';
- }
- elseif ($check >= 161)
- {
- $coats = 'Crested';
- }
- }
- elseif ($_POST['female-coats'] == 'short' AND $_POST['male-coats'] == 'crested')
- {
- if ($check >= 1 AND $check <= 110)
- {
- $coats = 'Standard';
- }
- elseif ($check >= 111 AND $check <= 160)
- {
- $coats = 'Short';
- }
- elseif ($check >= 161)
- {
- $coats = 'Crested';
- }
- }
- elseif ($_POST['male-coats'] == 'short' AND $_POST['female-coats'] == 'silk')
- {
- if ($check >= 1 AND $check <= 120)
- {
- $coats = 'Standard';
- }
- elseif ($check >= 121 AND $check <= 150)
- {
- $coats = 'Short';
- }
- elseif ($check >= 151 AND $check <= 180)
- {
- $coats = 'Crested';
- }
- elseif ($check >= 181)
- {
- $coats = 'Silk';
- }
- }
- elseif ($_POST['female-coats'] == 'short' AND $_POST['male-coats'] == 'silk')
- {
- if ($check >= 1 AND $check <= 120)
- {
- $coats = 'Standard';
- }
- elseif ($check >= 121 AND $check <= 150)
- {
- $coats = 'Short';
- }
- elseif ($check >= 151 AND $check <= 180)
- {
- $coats = 'Crested';
- }
- elseif ($check >= 181)
- {
- $coats = 'Silk';
- }
- }
- elseif ($_POST['male-coats'] == 'crested' AND $_POST['female-coats'] == 'crested')
- {
- $coats = 'Standard';
- }
- elseif ($_POST['male-coats'] == 'crested' AND $_POST['female-coats'] == 'silk')
- {
- if ($check >= 1 AND $check <= 100)
- {
- $coats = 'Standard';
- }
- elseif ($check >= 101 AND $check <= 140)
- {
- $coats = 'Short';
- }
- elseif ($check >= 141 AND $check <= 175)
- {
- $coats = 'Crested';
- }
- elseif ($check >= 176)
- {
- $coats = 'Silk';
- }
- }
- elseif ($_POST['female-coats'] == 'crested' AND $_POST['male-coats'] == 'silk')
- {
- if ($check >= 1 AND $check <= 100)
- {
- $coats = 'Standard';
- }
- elseif ($check >= 101 AND $check <= 140)
- {
- $coats = 'Short';
- }
- elseif ($check >= 141 AND $check <= 175)
- {
- $coats = 'Crested';
- }
- elseif ($check >= 176)
- {
- $coats = 'Silk';
- }
- }
- elseif ($_POST['male-coats'] == 'silk' AND $_POST['female-coats'] == 'silk')
- {
- if ($check >= 1 AND $check <= 90)
- {
- $coats = 'Standard';
- }
- elseif ($check >= 91 AND $check <= 130)
- {
- $coats = 'Short';
- }
- elseif ($check >= 131 AND $check <= 170)
- {
- $coats = 'Crested';
- }
- elseif ($check >= 171)
- {
- $coats = 'Silk';
- }
- }
- echo '<br/><br/>';
- echo $check.'<br/>';
- echo $coats;
- }
- ?>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement