2016-ICT2613-portfolio_task3.php at master · deono_2016-ICT2613-portfolio · GitHub.pdf

Please enter a valid number for your weight else if

Info icon This preview shows page 1. Sign up to view the full content.

'Please enter a valid number for your weight' ; } else if ($height == FALSE ) { $error_message = 'Please enter a valid number for your height' ; } else if ($weight <= 0 ) { $error_message = 'Weight should be more than zero' ; } else if ($height <= 0 ) { $error_message = 'Height should be more than zero' ; } else { $error_message = '' ; } } //calculate BMI if ($weight && $height) { $bmi = $weight / ($height * $height); $bmi_f = number_format ($bmi, 1 ); } // set value of weight indicator if ($bmi_f < 18.5 ) { $weight_indicator = 'Underweight' ; } else if ($bmi_f >= 18.5 || $bmi <= 24.9 ) { $weight_indicator = 'Healthy weight' ; } else if ($bmi_f >= 25 || $bmi <= 29.9 ) { $weight_indicator = 'Overweight' ; } else if ($bmi_f > 30 ) { $weight_indicator = 'Obese' ; } ?> <!DOCTYPE html> < html > < head > < meta charset = "UTF-8" > < link rel = "stylesheet" type = "text/css" href = "main.css" > < title >Task 3</ title > </ head > < body > < header > <?php include 'menu.inc' ; ?> </ header > < main > <!-- output --> < h2 >Task 3</ h2 > < div class = "output" > < h3 >BMI Calculator</ h3 > <?php if ($error_message != '' ) { ?> < p class = "error_message" ><?php echo htmlspecialchars ($error_message) ?></ p > <?php }?> < form action = "task3.php" method = "post" > < label >Measurement system: </ label > < input type = "radio" name = "system" value = "imperial" >< span >Imperial</ span > < input type = "radio" name = "system" value = "metric" checked >< span >Metric</ span >< br > < br >< br > < label for = "weight" >Enter weight: </ label > < input type = "text" name = "weight" >< span > & nbsp ; (Pounds or Kilograms)</ span >< br > < label >Enter height: </ label > < input type = "text" name = "height" >< span > & nbsp ; (Inches or Meters)</ span >< br > < label > & nbsp ; </ label > < input type = "submit" value =
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '12
  • Body mass index, Prime number, 3.5 kb

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern