johnwboyd
02-27-2014, 09:59 AM
On the product pages we have a code like this:
<select name="paymentmethod1" id="paymentmethod1">
<option value="MoneyPak">MoneyPak</option>
</select>
<select name="paymentmethod2" id="paymentmethod2">
<option value="MoneyPak">MoneyPak</option>
</select
etc.
Through Session it writes to the order checkout form header as text such as MoneyPak or Credit Card through the code:
<?php echo($_SESSION["paymentmethod".$counter]); ?>
Now what I am trying to do here is get the user selection of Credit Card or MoneyPak radio button from the product page to automatically trigger the corresponding radio button to be checked:
<input name="1" type="radio" class="radio2" id="creditcard" style="padding-left:0px"
onclick="showhide('creditcardxx', 'block'); showhide('m-p-kx', 'none');
showhide('splitx', 'none'); showhide('charge', 'block'); showhide('option3m', 'none');
showhide('option3', 'none'); showhide('option2', 'block')" value="creditcard"/>
I was thinking it could be something like this maybe but I can't get it to work:
<input name="1" <?php if (echo($_SESSION["paymentmethod".$counter])=='MoneyPak') {
echo checked="checked" ;} ?> type="radio" class="radio" id="MoneyPak"
onclick="showhide('m-p-kx', 'block'); showhide('splitx', 'none');
showhide('creditcardxx', 'none'); showhide('paypalx', 'none'); showhide('charge',
'none'); showhide('option3', 'none'); showhide('option3m', 'none'); showhide('option2',
'none');" value="MoneyPak">
I also don't know if I should have else in both radio buttons or not.
<select name="paymentmethod1" id="paymentmethod1">
<option value="MoneyPak">MoneyPak</option>
</select>
<select name="paymentmethod2" id="paymentmethod2">
<option value="MoneyPak">MoneyPak</option>
</select
etc.
Through Session it writes to the order checkout form header as text such as MoneyPak or Credit Card through the code:
<?php echo($_SESSION["paymentmethod".$counter]); ?>
Now what I am trying to do here is get the user selection of Credit Card or MoneyPak radio button from the product page to automatically trigger the corresponding radio button to be checked:
<input name="1" type="radio" class="radio2" id="creditcard" style="padding-left:0px"
onclick="showhide('creditcardxx', 'block'); showhide('m-p-kx', 'none');
showhide('splitx', 'none'); showhide('charge', 'block'); showhide('option3m', 'none');
showhide('option3', 'none'); showhide('option2', 'block')" value="creditcard"/>
I was thinking it could be something like this maybe but I can't get it to work:
<input name="1" <?php if (echo($_SESSION["paymentmethod".$counter])=='MoneyPak') {
echo checked="checked" ;} ?> type="radio" class="radio" id="MoneyPak"
onclick="showhide('m-p-kx', 'block'); showhide('splitx', 'none');
showhide('creditcardxx', 'none'); showhide('paypalx', 'none'); showhide('charge',
'none'); showhide('option3', 'none'); showhide('option3m', 'none'); showhide('option2',
'none');" value="MoneyPak">
I also don't know if I should have else in both radio buttons or not.