Javascript 如何在php中使用标签名获取选定的Radio按钮值

Javascript 如何在php中使用标签名获取选定的Radio按钮值,javascript,php,html,Javascript,Php,Html,函数递增价格(复选框){ var增加=parseInt(checkbox.value); var price_inputs=document.getElementsByClassName(“价格输入”); var price_span=document.getElementsByClassName(“价格”); 对于(变量i=0;i

函数递增价格(复选框){
var增加=parseInt(checkbox.value);
var price_inputs=document.getElementsByClassName(“价格输入”);
var price_span=document.getElementsByClassName(“价格”);
对于(变量i=0;i
假日旅游
钦奈之旅(500卢比)
1人-费用为4700卢比/
如何在下面的字段中显示上面的检查金额

全额支付费用/-

预付款费用/-


旅游套餐:

为了解决这个问题,我创建了一个新的Javascript函数来更新全价单选按钮和标签。您可以使用类似的方法支付预付款。实际上,每次调用
updatealPayment
时,我都会调用updateadvancepayment方法,以便它们保持同步

 function updateFullPayment(radio) {
   var value = parseInt(radio.value)
   var full_payment = document.getElementById("full-price");
   var full_payment_radio = document.getElementById("full-price-radio");
   full_payment.innerHTML = value;
   full_payment_radio.value = value;
 };
我还更新了Javascript函数,调用我的函数并传入当前选择的价格,以便始终更新完整的价格

 function increasePrice(checkbox) {
   var increase = parseInt(checkbox.value);
   var price_inputs = document.getElementsByClassName("price-input");
   var price_span = document.getElementsByClassName("price");
   for (var i = 0; i < price_inputs.length; i++) {
     var price = price_inputs.item(i);
     var newValue = parseInt(price.value);
     if (price_inputs.item(i).checked) {
       var selectedPrice = price_inputs.item(i);
     }
     if (checkbox.checked) {
       var newValue = newValue + increase;
     } else {
       var newValue = newValue - increase;
     }
     price_span.item(i).innerHTML = newValue;
     price.value = newValue;
 }

   updateFullPayment(selectedPrice);
 };
函数递增价格(复选框){
var增加=parseInt(checkbox.value);
var price_inputs=document.getElementsByClassName(“价格输入”);
var price_span=document.getElementsByClassName(“价格”);
对于(变量i=0;i
HTML现在看起来像这样。单击价格单选按钮将调用我创建的更新函数

<h1>Holiday Tour</h1>
<form role="form" action="" method="post" class="f1">
<label><input onclick="increasePrice(this)" type="checkbox" value="500" > Chennai Trip (Rs.500/-)</label>
<label><input onclick="updateFullPayment(this)" class="price-input" type="radio"  name="optradio" value="4700">
                                                          1 PERSON - <b>Cost Rs.<span class="price">4700</span>/- </b>
                                                          </label>
</form>
<p>how to display above checked amount to the below field</p>
<p><label><input type="radio" name="optradio" id="full-price-radio">
                                                          Full Payment    <b>Cost Rs<span id="full-price"></span>/-</b>
                                                          </label></p>
<p><label><input type="radio" name="optradio">
                                                          Advance Payment    <b>Cost Rs  /-</b>
                                                          </label></p>
<p>Tour Package : </p>
假日旅游
钦奈之旅(500卢比)
1人-费用为4700卢比/
如何在下面的字段中显示上面的检查金额

全额支付费用/-

预付款费用/-

旅游套餐:


grant显示其工作正常。我需要一个更多的帮助如何计算预付款,我需要显示50%的全额付款。此外,当用户单击1人单选按钮时,相应的旅行团名称将显示在付款页面???