PHP form handling is usually best done by using form field names and giving them a fixed value, then running calculations based on an amount placed in a neighbouring form field.
Let's say we have a form with one textbox. To the left of the textbox is a text description of the itee for sale - in this case, we'll call it a ruby.
So our web page reads "Please select how many rubies you would like to buy", then below this sentence there is a line of text that says:
and to the right of it is a textbox for you to input the number of rubies you want to buy.
Now comes the important bit. The name of the textbox is rubyqty [logical naming convention for goods offered "ruby" followed by quantity required "qty"].
So, now we can use the textbox value to calculate the cost if we have assigned a base value to ruby to begin with, like this:
$totalamount = $rubyqty * RUBYPRICE
If you link in the relevant echo statements you get a calculation based on a fixed item value from the define statement mutliplied by the number of them requested by the form user.
Type the number 4 into the textbox and you get 'defined price of ruby x 4 = ' as your calculation.
Or have I misunderstood where you're going with this ?