-2

what is a good replacement for a radio button? because i need to pass more than 1 value to the php page.

<table width="900" border="0" align="center" cellpadding="2" cellspacing="0" id='center'>
                <tr class="row_submit">
                    <td><input type="radio" name="carrier" <?php if (isset($carrier) && $carrier=="LBC") echo "checked";?>  value="LBC"></td>
                    <td><img src="../paymentoptions/LBC.jpg" alt="LBC" class="picture"/></td>
                    <td><p>The Shipping takes 1-2 days for NCR and 2-3 days for any provincial. Payment method is through BPI Bank Deposit.<p>
                        <div id='price'> Additional ₱250 </div></td>

                </tr>
                <tr class="row_submit">
                    <td><input type="radio" name="carrier" <?php if (isset($carrier) && $carrier=="PickUp") echo "checked";?>  value="PickUp"></td>
                    <td><img src="../paymentoptions/Pick-up.jpg" alt="Pick-Up" class="picture"/></td>
                    <td><p>Personally pick up your merchandise at our office. Free of Charge. Office hours: 10:00 am to 5:00 pm<p>
                        <div id='price'> Free!! </div></td>
                </tr>
            </table>

here are my codes, i need to pass a value for $payment which is slightly different but pre-defined.

so for example i need pressed, LBC the $carrier is LBC and the $payment is BPI.

so what is a good replacement for radio button when i click the forms, also i added a jquery that would automattically submit it when pressing the row.

Vince Agno
  • 81
  • 2
  • 7

2 Answers2

0

I am not sure if I follow your question but can you resolve this with php when the form is submitted through logic?

if($_POST['carrier'] == 'LBC'){
    //then payment has to be BPI correct?
}

It does not appear to me that you have more than one payment option.

If you need a second input on the form to show the payment method when clicking the radio for LBC you could use jquery to set it.

<input type="hidden" name="payment" value=""/>

then in jquery

$('input[name=carrier]').click(function(){
    if ($(this).is(':checked')){
        $('input[name=payment]').val('BPI');
    }
});
silversunhunter
  • 1,219
  • 2
  • 12
  • 32
0

if the other value you want to send is predefined, you might want to use a hidden field and use javascript to populate the hidden field upon selection

e.g.

<input type="hidden" name="payment" value="" />

and in your jQuery (you don't need jquery but you mentioned it)

$(document).ready(function() {
    $(input:radio[name=shipping]).change(function(){
        if ($(input:radio[name=shipping]).val() === 'X') { 
            $(input:radio[name=payment]).val('Y');
        }
    })
}
Jack
  • 172
  • 13