I currently have a form and below the form, I have a checkbox and some radio buttons. Here is the code for the checkbox and radio buttons:
<li id="discountCheckbox" class=" ">
<label class="desc" id="title416" for="Field416">
Discounts Available:
</label>
<div>
<span>
<input id="discountCheckbox" name="discountCheckbox" type="checkbox" class="field checkbox" value="Past Host Discount - 10%" tabindex="12" />
<label class="choice" for="Field416">Past Host Discount - 10%</label>
</span>
</div>
</li>
<li id="shipping1" class=" ">
<label class="desc" id="shippingChoice" name="shippingLabel" value="yahha" for="Field517_0">
Shipping Options
</label>
<div>
<input id="9281" name="9821" type="hidden" value="" />
<span>
<input id="shipping1" name="shipping1" type="radio" class="field radio" value="cost" tabindex="13" checked="checked" onclick="setShippingSpan('$2.00');" />
<label class="choice" for="Field517_0" >
$2.00 Shipping Fee</label>
</span>
<span>
<input id="shipping2" name="shipping1" type="radio" class="field radio" value="free" tabindex="14" onclick="setShippingSpan('$0.00');" />
<label class="choice" for="Field517_1" >
I will pick up the items (free shipping)</label>
</span>
</div>
</li>
On submission of my form, I have a file process.php that is run. In that file, I grab the value of the checkbox using $_POST["discountCheckbox"]. But, I can’t figure out how to grab the value of the radio buttons (determining which one is selected). How do I do this?
Give the radio buttons all the same name and then that name in your
$_POSTwill have the value of the selected radio button.