View Question
 Question
 Subject: Basic PHP script Category: Computers > Programming Asked by: marcus_venturi-ga List Price: \$20.00 Posted: 19 Nov 2004 16:29 PST Expires: 19 Dec 2004 16:29 PST Question ID: 431303
 ```Hi! I'ld need a clean PHP script (output.php) that, given the following input page (input.htm) where the user select the weight and volume of a package to be shipped, returns the prices of various couriers ("yellow", "blue" and "black"). ~~~ input page input.htm:
SELECT THE VOLUME OF YOUR PACKAGE: from 0 to 1 m3 from 1 to 2 m3 from 2 to 3 m3
SELECT THE WEIGHT OF YOUR PACKAGE: from 0 to 100 Kg from 100 to 200 Kg from 200 to 300 Kg ~~~ istructions to be integrated in the "output.php" script: Courier "yellow" - for volume 1, 2 and 3: if weight=100 then rate=600 if weight=200 then rate=900 if weight=300 then rate=1200 Courier "blue" - for volume 1 and 2: if weight=100 then rate=400 if weight=200 then rate=700 Courier "black" - for volume 2 and 3: if weight=100 then rate=800 if weight=200 then rate=1100 if weight=300 then rate=1500 ~~~ sample request and result: Example A) With the user input: volume=2 weight=300 output.php must generate this result: courier "yellow" = 1200 courier "black" = 1500 Example B) With the user input: volume=1 weight=100 output.php must generate this result: courier "yellow" = 600 courier "blue" = 400 After this basic script, I'll probably post new questions for some extensions. Thanks, Marcus```
 Subject: Re: Basic PHP script Answered By: googleexpert-ga on 20 Nov 2004 07:59 PST
 ```Hi marcus_venturi-ga, Here is the basic PHP script with some modifications to input.htm File: input.htm
SELECT THE VOLUME OF YOUR PACKAGE: from 0 to 1 m3 from 1 to 2 m3 from 2 to 3 m3
SELECT THE WEIGHT OF YOUR PACKAGE: from 0 to 100 Kg from 100 to 200 Kg from 200 to 300 Kg
File: output.php Courier 'Blue' = 400"; \$couriers["1"]["200"] = "Courier 'Yellow' = 900
Courier 'Blue' = 700"; \$couriers["1"]["300"] = "Courier 'Yellow' = 1200"; \$couriers["2"]["100"] = "Courier 'Yellow' = 900
Courier 'Blue' = 400\nCourier 'Black' = 800"; \$couriers["2"]["200"] = "Courier 'Yellow' = 900
Courier 'Blue' = 700\nCourier 'Black' = 1100"; \$couriers["2"]["300"] = "Courier 'Yellow' = 1200
Courier 'Black' = 1500"; \$couriers["3"]["100"] = "Courier 'Yellow' = 600
Courier 'Black' = 800"; \$couriers["3"]["200"] = "Courier 'Yellow' = 900
Courier 'Black' = 1100"; \$couriers["3"]["300"] = "Courier 'Yellow' = 1200
Courier 'Black' = 1500"; print \$couriers[\$volume][\$weight]; ?> Please let me know if you have any questions. Thank you. -googleexpert```