Main Carriers such as FedEx, UPS, and DHL have begun to use \"dimensional weight
ID: 3765863 • Letter: M
Question
Main Carriers such as FedEx, UPS, and DHL have begun to use "dimensional weight" for calculating the shipping cost of parcels. Dimensional Weight (lbs)= Length (inch) x Width (Inch) x Height (inch) /166 or Dimensional weight (kg)= Length (cm) x Width (cm X Height (cm)/ 5000 in metric system. use php or javascript to make a form on the web so that user can input length, width and height to calculate the dimension weights. User should have option to choose metric cm or in. If you choose metric calculate kg else calculate lbs.
Explanation / Answer
Here you go
1. Index.php
<html>
<head>
<title>CHEGG Tutorial</title>
</head>
<body>
<form action="dimensional_weight.php" method="get">
<br>
<input type="radio" name="type" value="cm">CM
<input type="radio" name="type" value="inch">inch
<br><br>
Length:<br>
<input type="text" name="length">
<br>
Width:<br>
<input type="text" name="width">
<br>
Height:<br>
<input type="text" name="height">
<br>
<br>
<input type="submit" value="Submit">
</form>
</body>
</html>
2. dimensional_weight.php
<?php
$length = $_GET['length'];
$width = $_GET['width'];
$height = $_GET['height'];
$id = $_GET['type'];
$weight = $length * $width * $height;
echo "Selected weight option is: " .$id ." ";
echo "Dimensional weight is: ";
if (strcmp("inch", $id)) {
echo $weight / 166;
echo " lbs";
} else {
echo $weight / 5000;
echo " kg";
}
?>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.