Question

In: Computer Science

Write a PHP program using HTML form. It will take Length, Width and Height of a...

Write a PHP program using HTML form. It will take Length, Width and Height of a box as input. When a button is pressed, it will calculate the Volume. If Volume is less than 25 then display the message “Small box”. If Volume is from 25 to 50, it will display the message “Medium box”. When the Volume is greater than 50, then display the message “Large box”.

Solutions

Expert Solution

index.html file :-

<html>
<center>
<body>
<form action="index.php" method="post">

<label for="Length"><b>Length</b></label>
<input type="text" placeholder="Length" name="Length" required><br><br>
<label for="Width"><b>Width</b></label>
<input type="text" placeholder="Width" name="Width" required><br><br>
<label for="Height"><b>Height</b></label>
<input type="text" placeholder="Height" name="Height" required><br><br>

<input type="submit" value="submit">
</form>

</body>
</center>
</html>

index.php file :-

<html>
<body>
<center>
<?php

if(isset($_POST['Length']) && isset($_POST['Width']) && isset($_POST['Height']))
{
$length = $_POST['Length'];
$width = $_POST['Width'];
$height = $_POST['Height'];

$volume = $length * $width * $height;
    if ($volume<25)
    {
          echo "Small box";
    }
    elseif ($volume>=25 && $volume<=50)
    {
         echo "Medium box";
    }
    elseif ($volume>50)
    {
        echo "Large box";
    }
}

?>
</center>
</body>
</html>

Sreenshot of file and output:-


Related Solutions

- Create an html form (bank form) and the PHP code with 2 accounts with options...
- Create an html form (bank form) and the PHP code with 2 accounts with options to transfer, deposit or withdraw money.
C++ Question: write a program that prompts the user for the length and width of a...
C++ Question: write a program that prompts the user for the length and width of a rectangle in inches.  The program then uses functions to compute the perimeter and area of the rectangle and to convert those to meters and square meters respectively. Sample output from one instance of the program is shown below: ```html Welcome to the Foot-To-Meter Rectangle Calculator ================================================= Enter the rectangle length in feet: 2 Enter the rectangle width in feet: 3 The rectangle dimensions are: 0.61...
1. Write a Python program that will ask the user length and width of the right...
1. Write a Python program that will ask the user length and width of the right triangle and find the area of the right-angled triangle. The formula for finding the area of a right-angle triangle is ab/2. Also, find out the result if you calculate as (ab)/2. Is it the same? If it is same, why it is the same. If it is not the same, why it is not the same.
write php code for buying and selling web using sql, javascript ,html ,css style
write php code for buying and selling web using sql, javascript ,html ,css style
Write a program checkerboard3x3.cpp that asks the user to input width and height and prints a...
Write a program checkerboard3x3.cpp that asks the user to input width and height and prints a checkerboard of 3-by-3 squares. (It should work even if the input dimensions are not a multiple of three.) . Don't use function. Example 1: Input width: 16 Input height: 11 Shape: *** *** *** *** *** *** *** *** *** *** *** * *** *** * *** *** * *** *** *** *** *** *** *** *** *** *** *** * *** *** *...
Write a log-in log-out session using PHP, CSS, and HTML only. NO MYSQL and JavaScript allowed....
Write a log-in log-out session using PHP, CSS, and HTML only. NO MYSQL and JavaScript allowed. 1. Need an HTML form and a login form; separate file. 2. need a CSS file to make it look good 3. Must store visitors' info in a .txt file and validate from there if the user exists before granting access to the dashboard. If the user does not exist, render the form to signup. If the user exists take them to their dashboard....
Please write "my account" page program by using HTML and CSS
Please write "my account" page program by using HTML and CSS
Need to write a program and part 1 of the program is to write an HTML...
Need to write a program and part 1 of the program is to write an HTML code, here are the parameters, but I am new to HTML and I am confused as to how to write this. 1) HTML file shall:         - have your name(s) somewhere near the top, as a comment.         - be a complete html document with appropriate html tags.         - have 1 form with 2 parts, described as follows:         part 1:             -...
The length, width, and height of a box are measured as 5 ft, 4 ft, and...
The length, width, and height of a box are measured as 5 ft, 4 ft, and 8 ft, respectively, with an error in measurement of at most 0.3 ft in each. Use differentials to estimate the maximum error (in feet) in the calculated volume of the box.
The length ℓ, width w, and height h of a box change with time. At a...
The length ℓ, width w, and height h of a box change with time. At a certain instant the dimensions are ℓ = 4 m and w = h = 1 m, and ℓ and w are increasing at a rate of 8 m/s while h is decreasing at a rate of 2 m/s. At that instant find the rates at which the following quantities are changing. (a) The volume. (b) The surface area. (c) The length of a diagonal....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT