Simple Radio Button Script Help Please

Discussion in 'HTML & Website Design' started by mattyp747, Jan 13, 2008.

  1. #1
    hi im looking for a script so that when a radio button is selected and you click on the submit button it will take you to the page relevant to what you chose, eg: (0) = radio button!

    (0) option 1
    (0) option 2

    submit button

    if you checked option 1 and clicked submit would take you to say 1.html and if you clicked option 2 would take you to say 2.html.

    you can only have one button selected at one time.

    please help, i know this is simple but cannot work it out, sorry.
     
    mattyp747, Jan 13, 2008 IP
  2. Bohol

    Bohol Peon

    Messages:
    2,680
    Likes Received:
    75
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Check dynamicdrive.com there are lots of scripts there.
     
    Bohol, Jan 13, 2008 IP
  3. mattyp747

    mattyp747 Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3

    i had already checked there and cant find anything that helps. :eek:

    can you give me a direct link?
     
    mattyp747, Jan 13, 2008 IP
  4. guestonline

    guestonline Banned

    Messages:
    669
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    u need the html code???
     
    guestonline, Jan 13, 2008 IP
  5. mattyp747

    mattyp747 Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yup please. :)
     
    mattyp747, Jan 13, 2008 IP
  6. guestonline

    guestonline Banned

    Messages:
    669
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #6
    i can help with the php code
     
    guestonline, Jan 13, 2008 IP
  7. mattyp747

    mattyp747 Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    php,html either and or!

    can someone post the code please!!!!!

    cheers.
     
    mattyp747, Jan 13, 2008 IP
  8. guestonline

    guestonline Banned

    Messages:
    669
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #8
    <html>
    <head>
    <title>My Page</title>
    </head>
    <body>
    <form name="myform" action="temp1.php" method="POST">
    <div align="center"><br>
    <input type="radio" name="group1" value="Milk"> Milk<br>
    <input type="radio" name="group1" value="Butter" checked> Butter<br>
    <input type="radio" name="group1" value="Cheese"> Cheese

    </div>
    </form>
    </body>
    </html>



    it will get redirected to next page temp1.php..in this write php code follows

    <?php
    if($_POST['group1']=='Milk')
    header("Location : your page1);
    else
    header("Location : your page2);

    ?>
     
    guestonline, Jan 13, 2008 IP