Performing actions based upon radio button selection

Discussion in 'Programming' started by geekology, Jan 2, 2011.

  1. #1
    I need to include two payment gateways on my site. One gateway to accept USD while another to accept INR (Indian currency).

    I am planning to include two radio buttons ( 1) USD, 2) INR) on my web page . Now based upon the radio button selection, an appropriate payment gateway (image) should be shown.

    What is the best way to implement this scenario? (Backend is PHP/MySql)
     
    geekology, Jan 2, 2011 IP
  2. QiSoftware

    QiSoftware Well-Known Member

    Messages:
    805
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    158
    #2
    HTML Buttons and Javascript?

    Q...
     
    QiSoftware, Jan 2, 2011 IP
  3. Cozmic

    Cozmic Member

    Messages:
    146
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    48
    #3
    Something like this. Untested.

    
    
    <script type="text/javascript">
    function check() {
       obj = document.currency.type;
       value = type.value;
    
       alert(value + " was selected");
       
       // the below text that is commented is an example of how to show an iframe based on the selection.
       // document.getElementById('frame').innerHTML = "<iframe src='payment.html?type="+value+"' />";
    }
    </script>
    
    <form name="currency">
    <input type="radio" name="type" value="usd" onchange="check" /> USD <input type="radio" name="type" value="INR" onchange="check()" /> INR
    </form>
    
    <span id='frame'></span>
    
    
    Code (markup):
     
    Cozmic, Jan 2, 2011 IP
  4. geekology

    geekology Well-Known Member

    Messages:
    545
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    110
    #4
    geekology, Jan 4, 2011 IP