Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php include 'header.php'; ?>
- <script language="JavaScript">
- <!--
- function calculateBmi() {
- var weight = document.bmiForm.weight.value
- var height = document.bmiForm.height.value
- if(weight > 0 && height > 0){
- var finalBmi = weight/(height/100*height/100)
- document.bmiForm.bmi.value = finalBmi
- if(finalBmi < 18.5){
- document.bmiForm.meaning.value = "You are too thin."
- }
- if(finalBmi > 18.5 && finalBmi < 25){
- document.bmiForm.meaning.value = "Your are healthy."
- }
- if(finalBmi > 25){
- document.bmiForm.meaning.value = "You have overweight."
- }
- }
- else{
- alert("Please Fill in everything correctly")
- }
- }
- //-->
- </script>
- <style>
- td {
- height:20px;
- }
- </style>
- <?php if(!isset($_SESSION['u_name']) && empty($_SESSION['u_name'])){
- echo '<div class="bigbox">
- <div class="heading" style="margin-top:50px;">Sorry ! you are not logged in. | Login to view this Page</div>
- <hr></div>';
- }else {
- echo'
- <div class="bigbox">
- <div class="heading" style="margin-top:50px;">Calculate Your Body Mass Index (BMI) | Calculator is Below</div>
- <hr>
- <table border="0" style="width:650px;margin:0 auto;border:2px solid #F25822;
- border-radius:5px;padding-top:15px;padding-left:5px;padding-bottom:15px;padding-right:5px;box-shadow:0px 0px 5px 5px grey;margin-top:40px;">
- <tr>
- <form name="bmiForm">
- <td>Your Weight(kg):</td><td><input type="text" name="weight" placeholder="Your Weight (Kg)"></td>
- <td>Your Height(cm): </td><td><input type="text" name="height" placeholder="Your Height (CM)"></td></tr>
- <tr><td colspan="4"><hr style="display:none;"></td></tr>
- <tr><td colspan="4" align="right"><input type="button" value="Calculate BMI" style="width:200px;margin-right:30px;" onClick="calculateBmi()" class="button"></td></tr>
- <tr><td colspan="4"><hr ></td></tr>
- <tr><td>Your BMI:</td><td colspan="3"><input type="text" readonly style="border:none;font-weight:bold;" size="65" name="bmi" placeholder="Your BMI Calculations will show here"></td></tr>
- <tr><td>Remarks: </td><td colspan="3"><input type="text" readonly style="border:none;font-weight:bold;" size="65" name="meaning" placeholder="Remarks"></td></tr>
- <tr><td colspan="4"><hr style="display:none;"></td></tr>
- <tr><td colspan="4" align="right"><input type="reset" value="Reset" style="width:200px;margin-right:30px;" class="button" /></td></tr>
- </form>
- </table>
- </div>';}
- ?>
- <?php include 'footer.php'; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement