I have a form with a series of radio buttons and checkboxes used to tally up a cost before sending the user to a payment gateway.
The inputs are nothing unusual, except I've used the 'value' property for the associated price as when any input is changed, a table is edited to show chosen options, their associated prices and then the total.
<input type="checkbox" id="cb1" value="100" name="cb1">
<input type="checkbox" id="cb2" value="200" name="cb2">
<input type="radio" id="rd1" value="500" name="rdo">
<input type="radio" id="rd2" value="500" name="rdo">
I was slightly stupid and didn't think ahead as to how I was then going to actually process the completed form when submitted in terms of determining what the user has selected.
Sending the final total through is fine as that's stored in a readonly input. However, I also need to save to the database which checkboxes have been selected and which radio is selected.
The checkboxes are manageable as they only have a value in $_POST if they are ticked so I can cycle through them all and only keep the ones whose value isn't empty.
Any thoughts for how to handle the radio buttons? Re-writing the form is a last resort at this stage if possible to not do so.
value, however from the above I see that both have same value, so do you need to pass theidof it instead?