how can we change the value by using radio buttons

Posted by magna on Stack Overflow See other posts from Stack Overflow or by magna
Published on 2010-12-24T09:16:10Z Indexed on 2010/12/24 9:54 UTC
Read the original article Hit count: 205

Filed under:
|
|
|
|

I am making a website in Adobe Dreamweaver with php. In the site there’s a 3 buttons for selecting payment method that will act as the continue button. What I want is when the user checks a radio buttons (I agree button), it will be add with that amount and display with previous amount.. there is three buttons which has the corresponding values(amount in pounds)..

plz check my website http://www.spsmobile.co.uk in this linkgo to mobile phone unlocking and after add the cart click make payment it will go to next page there is a delivery mail details.. for that delivery mail details only am asking.. here i mentioned code:

<input id="radio-1" type="radio" name="rmr" value="1"> 
<label for="radio-1">£3</label> <input id="radio-2" type="radio" name="rmr" value="2">     
<label for="radio-2">£5.5</label> 
<input id="radio-3" type="radio" name="rmr" value="4"> 
<label for="radio-3">£10</label>  


<div class="total-text" style="font-size:36px">£10</div> 



  var total = parseInt($("div.total-text").text().substring(1), 10);  
    $("input[name='rmr']").bind('change', function() {     
      var amount = 0;     
      switch (this.value) {     
              case "1":         
                          amount = 3;         
                          break;     
              case "2":         
                          amount = 5.5;                          
                          break;     
              case "4":         
                          amount = 10;         
                          break;     
      }      
      $("div.total-text").text("£" + (total + amount)); 
   }); 

but there is no change , my previous amount did not add with that. while am clicking previous amount only displayed on browser.. i need when i cliks radio button the value should change correspondingly.. where i did that mistake...plz give me some idea and what should i do..is there any need for storing db..

thanks in adv

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery