radio buttons

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Shelly

    #1

    radio buttons

    I have used radio buttons often in the past, but now I am having problems.
    Please, someone, look at this simple code and tell me where I am going
    wrong. I cannot retrieve the posted value of gender when I click either
    button (male or female)

    I have tried (in desperation)
    1 - removing the target statement on the form.
    2 - adding [] to become name="gender[]".
    3 - changing the values to 1 and 2.

    Nothing is working. It must be something extremely simple and obvious, but
    I just can't see it.

    This has worked for me many times in the past. Does anyone see ANYTHING?
    The complete code is below between the "******" lines, and can be cut and
    pasted.

    Shelly

    *************** *************** *
    <?php
    if (isset($_POST['update'])) {
    $gender = $POST['gender'];
    echo "gender=" . $gender . "<br>";
    }
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitl ed Document</title>
    </head>

    <body>
    <form action="" method="post" name="propertie s" TARGET="_SELF">
    <table>
    <tr>
    <td>Male<inpu t type="radio" name="gender" value="M">&nbsp ;&nbsp;
    Female<input type="radio" name="gender" value="F"></td>
    </tr>
    <tr align="center">
    <td colspan="2"><in put type="submit" name="update" value="Update"> </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    *************** *************** ***


  • Chuck Anderson

    #2
    Re: radio buttons

    Shelly wrote:
    I have used radio buttons often in the past, but now I am having problems.
    Please, someone, look at this simple code and tell me where I am going
    wrong. I cannot retrieve the posted value of gender when I click either
    button (male or female)
    >
    I have tried (in desperation)
    1 - removing the target statement on the form.
    2 - adding [] to become name="gender[]".
    3 - changing the values to 1 and 2.
    >
    Nothing is working. It must be something extremely simple and obvious, but
    I just can't see it.
    >
    This has worked for me many times in the past. Does anyone see ANYTHING?
    The complete code is below between the "******" lines, and can be cut and
    pasted.
    >
    Shelly
    >
    *************** *************** *
    <?php
    if (isset($_POST['update'])) {
    $gender = $POST['gender'];
    echo "gender=" . $gender . "<br>";
    }
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitl ed Document</title>
    </head>
    >
    <body>
    <form action="" method="post" name="propertie s" TARGET="_SELF">
    <table>
    <tr>
    <td>Male<inpu t type="radio" name="gender" value="M">&nbsp ;&nbsp;
    Female<input type="radio" name="gender" value="F"></td>
    </tr>
    <tr align="center">
    <td colspan="2"><in put type="submit" name="update" value="Update"> </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    *************** *************** ***
    >
    >
    >
    I hope you don't have a gun nearby or you might shoot yourself.

    if (isset($_POST['update'])) {
    $gender = $POST['gender'];

    You're missing the '_' in $POST['gender'].

    --
    *************** **************
    Chuck Anderson • Boulder, CO

    *************** **************

    Comment

    • Shelly

      #3
      Re: radio buttons


      "Chuck Anderson" <websiteaddress @seemy.sigwrote in message
      news:EJadnZUBNN _8drfYnZ2dnUVZ_ oWdnZ2d@comcast .com...
      I hope you don't have a gun nearby or you might shoot yourself.
      >
      if (isset($_POST['update'])) {
      $gender = $POST['gender'];
      >
      You're missing the '_' in $POST['gender'].
      BOOM!!!!! I knew it had to be something stupid and obvious. Thanks. By
      the way, this didn't work so well when I had "M" and "F" as the values, but
      worked properly with "1" and "2". In the past I had always used numbers.
      Curious?????

      Shelly


      Comment

      • flamer die.spam@hotmail.com

        #4
        Re: radio buttons


        Shelly wrote:
        "Chuck Anderson" <websiteaddress @seemy.sigwrote in message
        news:EJadnZUBNN _8drfYnZ2dnUVZ_ oWdnZ2d@comcast .com...
        I hope you don't have a gun nearby or you might shoot yourself.

        if (isset($_POST['update'])) {
        $gender = $POST['gender'];

        You're missing the '_' in $POST['gender'].
        >
        BOOM!!!!! I knew it had to be something stupid and obvious. Thanks. By
        the way, this didn't work so well when I had "M" and "F" as the values, but
        worked properly with "1" and "2". In the past I had always used numbers.
        Curious?????
        >
        Shelly
        case-sensitive.

        Flamer.

        Comment

        • .:[ ikciu ]:.

          #5
          Re: radio buttons

          Hmm Shelly <sheldonlg.news @asap-consult.comwrot e:
          always used numbers. Curious?????
          before compare try to use strtoupper or strtolower

          --
          ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
          Ikciu | gg: 718845 | yahoo: ikciu_irsa | www: www.e-irsa.pl

          2be || !2be $this =mysql_query();


          Comment

          • Pedro Graca

            #6
            Re: radio buttons

            ["Followup-To:" header set to comp.lang.php.]
            Shelly wrote:
            >
            "Chuck Anderson" <websiteaddress @seemy.sigwrote in message
            news:EJadnZUBNN _8drfYnZ2dnUVZ_ oWdnZ2d@comcast .com...
            >I hope you don't have a gun nearby or you might shoot yourself.
            [...]
            >You're missing the '_' in $POST['gender'].
            >
            BOOM!!!!!
            For your next script try upping the error reporting of PHP

            <?php
            error_reporting (E_ALL);
            ini_set('displa y_errors', '1');

            $x = $_POST['x'];
            $y = $POST['y'];

            // ...
            ?>

            --
            File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

            Comment

            • Shelly

              #7
              Re: radio buttons


              <die.spam@hotma il.comwrote in message
              news:1160453154 .627178.61680@h 48g2000cwc.goog legroups.com...
              >
              Shelly wrote:
              >
              >"Chuck Anderson" <websiteaddress @seemy.sigwrote in message
              >news:EJadnZUBN N_8drfYnZ2dnUVZ _oWdnZ2d@comcas t.com...
              I hope you don't have a gun nearby or you might shoot yourself.
              >
              if (isset($_POST['update'])) {
              $gender = $POST['gender'];
              >
              You're missing the '_' in $POST['gender'].
              >>
              >BOOM!!!!! I knew it had to be something stupid and obvious. Thanks. By
              >the way, this didn't work so well when I had "M" and "F" as the values,
              >but
              >worked properly with "1" and "2". In the past I had always used numbers.
              >Curious?????
              >>
              >Shelly
              >
              case-sensitive.
              I was using capitals all the way. I used "M" and "F", never "m" or "f". I
              am careful about case. I just went back and tried it again with a second
              test script and this time it worked fine with "M" and "F",

              Shelly

              Shelly


              Comment

              Working...