Php 如何在输入中传递1个以上的值?

Php 如何在输入中传递1个以上的值?,php,html,forms,Php,Html,Forms,什么是单选按钮的好替代品?因为我需要向php页面传递多个值 <table width="900" border="0" align="center" cellpadding="2" cellspacing="0" id='center'> <tr class="row_submit"> <td><input type="radio" name="carrier" <?php i

什么是单选按钮的好替代品?因为我需要向php页面传递多个值

<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>
这是我的代码,我需要为$payment传递一个值,这个值稍有不同,但是预定义的

例如,我需要按下LBC,$carrier是LBC,$payment是BPI


那么,当我单击表单时,什么是单选按钮的好替代品呢?我还添加了一个jquery,在按行时自动提交它。

我不确定我是否理解你的问题,但当表单通过逻辑提交时,你能用php解决这个问题吗

if($_POST['carrier'] == 'LBC'){
    //then payment has to be BPI correct?
}
在我看来,您没有不止一个付款选项

如果您需要在表单上进行第二次输入,以便在单击LBC收音机时显示付款方式,您可以使用jquery进行设置

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

如果要发送的其他值是预定义的,则可能需要使用隐藏字段,并在选择时使用javascript填充隐藏字段

e、 g

$('input[name=carrier]').click(function(){
    if ($(this).is(':checked')){
        $('input[name=payment]').val('BPI');
    }
});
<input type="hidden" name="payment" value="" />
$(document).ready(function() {
    $(input:radio[name=shipping]).change(function(){
        if ($(input:radio[name=shipping]).val() === 'X') { 
            $(input:radio[name=payment]).val('Y');
        }
    })
}