Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: Radio Button

  1. #1
    New to the CF scene
    Join Date
    Jul 2007
    Location
    India
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Radio Button

    Hi,
    I have radio buttons on HTML page. How can I process my request on just clicking the radio button........I am not using java script......I have tried onclick and onselect attributes............but they are only meant for scripts......Can I put the radio button in hyper link.........any help !!!!

  • #2
    New Coder
    Join Date
    Jul 2007
    Location
    Yorkshire, UK
    Posts
    54
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Well you will need to use some server-side scripting such as PHP or Perl. You would do this like:

    First Page:
    Code:
    <form action="page2.php" method="post">
    <input type="radio" name="myradio" /> My Radio Button
    <input type="submit" value="Submit" />
    </form>
    Second Page:
    Code:
    <?php
    $Myradiobutton = $_POST['myradio'];
    if($Myradiobutton == 'checked')
    {
    print "This radio is checked.";
    }
    ?>
    You can do it with other languages too, this is just in php.

    Hope it helps.

  • #3
    New to the CF scene
    Join Date
    Jul 2007
    Location
    India
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Blekk View Post
    Well you will need to use some server-side scripting such as PHP or Perl. You would do this like:

    First Page:
    Code:
    <form action="page2.php" method="post">
    <input type="radio" name="myradio" /> My Radio Button
    <input type="submit" value="Submit" />
    </form>
    Second Page:
    Code:
    <?php
    $Myradiobutton = $_POST['myradio'];
    if($Myradiobutton == 'checked')
    {
    print "This radio is checked.";
    }
    ?>
    You can do it with other languages too, this is just in php.

    Hope it helps.

    I am already using JSP as server side language.....Is there any way I can do it in JSP.......I cant use JavaScript !!

  • #4
    Regular Coder saeed's Avatar
    Join Date
    Oct 2002
    Location
    West Yorkshire
    Posts
    343
    Thanks
    32
    Thanked 0 Times in 0 Posts
    hello madhoriya22,
    I donno wht exactly u're tryin to do ....

    instead of page2.php in the above code write yourJSPfilename.jsp

    and rest of the code in your JSP page thts it.

    tht will do ... i guess.


    Saeed

  • #5
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    Just curious, but why can't you use Javascript? This sort of thing is precisely the time and reason to use Javascript.

    Also, Blekk, I'm pretty sure that method wouldn't work as the page would still need to be submitted before PHP (or JSP) could check to see if the radio button was checked.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •