Radio box code:
<input
type = "radio"
name = "choice"
value = "A" />Apples />
<input
type = "radio"
name = "choice"
value = "B" />Oranges<br />
$choice=array("A"=>1.00, "B"=>0.80);
echo $choice["A"]; // will give me the value of 1.00
echo $choice["B"]; // will give me the value of 0.80
Given the code snippet above, is there anything wrong in terms of either the HTML radio box, the array or the choices?
Nope, that looks perfectly fine.
Except for the random
/>after your Apples text, but I suspect this is a typo?You may also want to consider this. Probably what you are heading towards? 🙂
This would be the code that receives your radio choice. It makes sure the choice is valid and then prints it.