Im learning to use php to transfer vaiables between forms and I'm stuck trying to do something for a project.
I have an input box in a form which is named 'qty' this captures the quantity of a product. this is followed by a submit button which sends the user to an order form to fill out the rest of their details.
on the first page the value inserted into this input box within the form dictates the cost of the postage and the price of the product.
The break down is as follows.
if the person enters between:
1 - 10 the price per item is £1.95 and the postage is £1.99
11 - 20 the price per item is £1.75 and the postage is £3.95
21 - 50 the price per item is £1.55 and the postage is £4.95
51 - 100 the price per item is £1.35 and the postage is £6.95
101 + the price per item is £1.25 and the postage is £7.99
I have created the following code to capture this information:
would this be o.k to use to capture the prices and then use to output a sentance on the top of the next page similar to this:PHP Code:
$qty = $_POST['qty'];
if($qty < 11)
$postage = '1.99' || $price = '1.95';
if(($qty < 20) || ($qty > 11))
$postage = '3.95' || $price = '1.75';
if(($qty < 50) || ($qty > 21))
$postage = '4.95' || $price = '1.55';
if(($qty < 100) || ($qty > 51))
$postage = '6.95' || $price = '1.35';
if($qty > 100)
$postage = '7.95' || $price = '1.25';
$total = $qty * $price . $postage;
The title and id variables are from a database where the product is located.PHP Code:
print '. $title .' "X" '. qty .' "at" '. $price .' "plus" '. $postage .' "post and packaging = £" '. $total .'
Its the other variables that I want to also output from the form. I want the sentance to read back to the user as
product title X 5 at £1.95 plus £1.99 postage and packaging = £11.74
Any help would be greatly appreciated...