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...
Write a Python program that takes as input two numbers, the height, and width of a...
Write a Python program that takes as input two numbers, the height, and width of a rectangle. It then prints a rectangle with height lines and width characters in each line. The rectangle should contain information regarding its dimensions and area inside (centered vertically but not horizontally). If any part of the information (including two stars on each end and a space before and after the line) does not fit in the rectangle, then print the complete information after the...
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.
def draw_rectangle(height, width, char): """ ------------------------------------------------------- Prints a rectangle of height and width characters using the...
def draw_rectangle(height, width, char): """ ------------------------------------------------------- Prints a rectangle of height and width characters using the char character. Use: draw_rectangle(height, width, char) ------------------------------------------------------- Parameters: height - number of characters high (int > 0) width - number of characters wide (int > 0) char - the character to draw with (str, len() == 1) Returns: None ------------------------------------------------------ """ Enter height in characters: 3 Enter width in characters: 12 Enter the draw character: # ############ ############ ############
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 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 'Rectangle-Area.c' that inputs the length and width of a rectangle and outputs its...
Write a program 'Rectangle-Area.c' that inputs the length and width of a rectangle and outputs its area. The program consists of two functions: the main function and a function that computes and returns the area of a rectangle. The output of the program should be in the main program, not in the function.      Sample Input: 5 8   Sample Output: The area of a 5 by 8 rectangle is 40.
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....
Utilizing PHP and HTML code Create a form that has text inputs for two numbers and...
Utilizing PHP and HTML code Create a form that has text inputs for two numbers and a submit button. Submit the values to a program that calculates and displays the GCD of the two numbers. The greatest common divisor of two integers a and b is the largest integer that is a factor of both a and b. The GCD of any number and 1 is 1, and the GCD of any number and 0 is that number. For example:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT