207
PHP
9 print("</body></html>");
10 function CalculateCharge($ST, $WT, $DS) {
11 if ($ST=="Yes")
12 { $CH=$WT * $DS * 1; }
13 else
14 { $CH=$WT * $DS * 2; };
15 return($CH);
16 }
17 ?>
is example is quite similar to the example of Listing3.7 of JavaScript in Chapter 3.
e difference between JavaScript and PHP in this case is that JavaScript performs
calculations on the client side, while the PHP script performs calculations on the
server side.
In Listing7.5 (Req uest.html), line 7 specifies the action when the user clicks
on the submit button on the form. It instructs the server to activate the PHP program
DeliveryCharge.php. In this example, the PHP program and the HTML web
page are placed in the same folder on the server so that a directory pat ...