I have a problem that has been bothering me for days - I am trying to get a variable appended into a an option value when a checkbox is either left on or off. The variable is showing up, but not the way I intent, I want "No Subscription" to be appended into the option value when the checkbox is off, ans "subscribe" to be appended into the option value when the checkbox is on. Here is my script:
<?php
if(isset($_POST['subscribe']) == '1') {
$sub = ", Subscribe";
} else {
$sub = ", No Subscription";}
?>
--------------------------------------------------------------------------------------------
<form class="cart" action="http://serber.com" method="post">
<section class="clear"></section>
<label>Tampons (Non-Applicator) Regular : </label>
<select name="productpr">
<option value="NT12<?php printf($sub); ?>:17.95">1 Month - $17.95 <span></span> </option>
<option value="NT12 3 Months<?php printf($sub); ?>:33.85">3 Months - $33.85</option>
<option value="NT12 6 Months<?php printf($sub); ?>:57.70">6 Months - $57.70</option>
</select>
<input type="hidden" name="submitted" value="true" />
<br /><input type="submit" value="Add to Cart">
<input type="hidden" name="subscribe[]" value="0" />
<input type="checkbox" name="subscribe[]" value="1">Check Box if you wish to have a recurring subscription</input>
</form>
I am at my wit's end with this because it seems I have the isset correct but the checkbox value
is not being set.