Hi all,
I have an issue with a site I am making which lists radio buttons which are a set of donation options (some with predefined prices some with user dependant).
I used jQuery to populate a textbox with the value of the radio buttons so the person does not need to enter a price they want to donate.
The issue I am having is that I want the page to carry across the fund_id (which is the primary key) to the next page.
Currently the do / while loop goes through all of the recordset and passes across the last record's fund_id.
Please see my code below:
| | $('input.radioButton').click(function () { |
| | var checkedradio = $('[name="fund"]:radio:checked').val(); |
| | $('#totalPrice').val(checkedradio); |
|
And
| <h3>General</h3> |
| | | <?php do { ?> |
| | | <label><input class="radioButton" type="radio" name="fund" value="<?php echo $row_cat_general['fund_price']; ?>" id="<?php echo $row_cat_general['fund_name']; ?>" /><?php echo $row_cat_general['fund_name']; ?> <?php if ($row_cat_general['fund_price']!="") { ?>- £<?php echo $row_cat_general['fund_price']; ?><?php } else {?> <?php };?></label> |
| | | <br /> |
| | | <?php } while ($row_cat_general = mysql_fetch_assoc($cat_general)); ?> |
| <h3>Sponsorship</h3> |
| | | <?php do { ?> |
| | | <label><input class="radioButton" type="radio" name="fund" value="<?php echo $row_cat_sponsorship['fund_price']; ?>" /><?php echo $row_cat_sponsorship['fund_name']; ?> <?php if ($row_cat_sponsorship['fund_price']!="") { ?>- £<?php echo $row_cat_sponsorship['fund_price']; ?><?php } else {?> <?php };?></label> |
| | | <br /> |
| | | <?php } while ($row_cat_sponsorship = mysql_fetch_assoc($cat_sponsorship)); ?> | |
| <h3>Seasonal</h3> |
|
| | | <?php do { ?> |
| | | <label><input class="radioButton" type="radio" name="fund" value="<?php echo $row_cat_seasonal['fund_price']; ?>" /><?php echo $row_cat_seasonal['fund_name']; ?> <?php if ($row_cat_seasonal['fund_price']!="") { ?>- £<?php echo $row_cat_seasonal['fund_price']; ?><?php } else {?> <?php };?></label> |
| | | <br /> |
| | | <?php } while ($row_cat_seasonal = mysql_fetch_assoc($cat_seasonal)); ?> |
| | <br /> |
|
| | <span id="sprytextfield1"> |
|
| | <label>Enter Amount: |
|
| | <input name="total" type="text" id="totalPrice" /> |
|
| | </label> |
|
| | <span class="textfieldRequiredMsg">A donation amount is required.</span></span><br /> |
|
| | <input name="fund_id" type="hidden" value="<?php echo $row_cat_general['fund_id']; ?>" id="fund_id" /> |
|
| | <input name="button" type="submit" value="Select" /> | |
I hope this doesnt look weird, once I have post this.
Is there a way I can populate "totalPrice" input box AND have "fund_id" hidden field populated with the fund_id of the selected radio button?
Thanks for your help.