我有一个带有4个无线电输入的php表单,如下所示:
<?php if( $chauffeur_data['enable-paypal'] == '1' ) { ?>
<div class="radio-wrapper clearfix"><input type="radio" name="payment-method" value="paypal" <?php if( $paypal_check == '1' ) { echo 'checked="checked"'; } ?> /><label><?php esc_html_e('Pay with PayPal','chauffeur'); ?></label><img src="<?php echo plugins_url('../../assets/images/paypal.png', __FILE__); ?>"></div>
<?php } ?>
<?php if( $chauffeur_data['enable-stripe'] == '1' ) { ?>
<div class="radio-wrapper clearfix"><input type="radio" name="payment-method" value="stripe" <?php if( $stripe_check == '1' ) { echo 'checked="checked"'; } ?> /><label><?php esc_html_e('Pay with Credit Card','chauffeur'); ?></label><img src="<?php echo plugins_url('../../assets/images/stripe.png', __FILE__); ?>"></div>
<?php } ?>
<?php if( $chauffeur_data['enable-cash'] == '1' ) { ?>
<div class="radio-wrapper clearfix"><input type="radio" name="payment-method" value="cash" <?php if( $cash_check == '1' ) { echo 'checked="checked"'; } ?> /><label><?php esc_html_e('Pay with Cash to the Driver','chauffeur'); ?></label></div>
<?php } ?>
<?php if( $chauffeur_data['enable-pos'] == '1' ) { ?>
<div class="radio-wrapper clearfix"><input type="radio" name="payment-method" value="pos" <?php if( $pos_check == '1' ) { echo 'checked="checked"'; } ?> /><label><?php esc_html_e('Pay with Card on POS in the Car','chauffeur'); ?></label></div>
<?php } ?>
<?php // If all payment gateways are disabled
if( $chauffeur_data['enable-paypal'] != '1' && $chauffeur_data['enable-stripe'] != '1' && $chauffeur_data['enable-cash'] != '1' &&
$chauffeur_data['enable-pos'] != '1' ) { ?>
<input type="hidden" name="payment-method" value="cash" />
<?php } ?>
萧十郎