Posted by Steve on 10/11/23 11:28
> can anyone here do a php script to calculate the price of Venetian blinds
> once the client has put in their measurements ??
It's probably trivial but you still haven't stated what the calculation
involves. Let's guess...
<!-- calc.html -->
<html>
<head><title>Cost Calculator</title></head>
<body>
<p>Type your measurements into this form and click Calculate...</p>
<form method="post" action="calc.php">
Width (m): <input type="text" name="width_m" />
Height (m): <input type="text" name="height_m" />
<input type="submit" value=" Calculate... " />
</form>
</body>
</html>
<?php
// calc.php
define( 'COST_IN_POUNDS_PER_SQUARE_METRE', 10.00 );
$width_m = intval( $_POST['width_m'] );
$height_m = intval( $_POST['height_m'] );
$cost_pounds =
round( $width_m * $height_m * COST_IN_POUNDS_PER_SQUARE_METRE, 2
)
print 'Thanks for your query.<br />';
print 'Your blinds will cost £' . $cost_pounds . '<br />';
print 'This is not a quote. Errors and Omissions Excluded.<br />'
print 'Make <a href="calc.html">another calculation</a>';
?>
---
Steve
[Back to original message]
|