SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist Maujor's Avatar
    Join Date
    Mar 2005
    Location
    Rio de Janeiro - Brazil - South America
    Posts
    409
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Reading values from radio buttons

    Can't figure out why this code don't work.
    Help will be appreciate
    PHP Code:
    <form action="radio.php">
    <input type="radio" name="radiobutton" value="value1" />Yes <br />
    <input type="radio" name="radiobutton" value="value2" checked="checked" />No <br />
    <input type="submit" value="OK" />
    </form>
    <?php
    if($_POST['radiobutton'] == "value1"){
        echo 
    "The choice was YES";
    }
    elseif(
    $_POST['radiobutton'] == "value2"){
        echo 
    "The choice was NO";

    ?>
    Mauricio Samy Silva
    http://www.maujor.com/

  2. #2
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You haven't defined the method in yor form tag.
    <form action="radio.php" method="POST">
    -- Jelena --

  3. #3
    SitePoint Evangelist Maujor's Avatar
    Join Date
    Mar 2005
    Location
    Rio de Janeiro - Brazil - South America
    Posts
    409
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Jelena,
    Rsss! Thank you!
    Mauricio Samy Silva
    http://www.maujor.com/


Bookmarks

Posting Permissions

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