Web Analytics Made Easy -
StatCounter Radio Buttons in Form Name Issue - CodingForum

Announcement

Collapse
No announcement yet.

Radio Buttons in Form Name Issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Radio Buttons in Form Name Issue

    If I make a unique name such as field1, field 2 for the radio buttons for the form the radios don't change upon selection from one to the other. On the other hand if I give them all the same name such as "hi" the data doesn't write in the email. I can't use:
    <select name="name">Radios here</select> because the radios are not just a simple row but each have divs with table rows and fields which open below them when selected.

    This is the code that writes the data in the email:
    '.$_POST['radiofieldname'].'

    Anyone have a solution for this PLEASE?
    Earn up to 10-30% per day growth in Binary Options Trading!

  • #2
    Select != radio. Select's won't send anything back unless an <option> has been selected.
    You group your radios by providing them with the same name.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

    Comment


    • #3
      Originally posted by Fou-Lu View Post
      Select != radio. Select's won't send anything back unless an <option> has been selected.
      You group your radios by providing them with the same name.
      I'm sorry can you please clarify that in context of the code in entirety? I'm still a rookie. Thanks!:

      <input type="radio" name="hi" id="window" value="Text here." onClick="showHide('windows')" onChange="document.getElementById('showme').style.display=this.selectedIndex==0?'none':'block';"/>
      Last edited by johnwboyd; Sep 7, 2011, 01:31 PM.
      Earn up to 10-30% per day growth in Binary Options Trading!

      Comment


      • #4
        Code:
        <input type="radio" name="hi" id="window" value="Text here." onClick="showHide('windows')" onChange="document.getElementById('showme').style.display=this.selectedIndex==0?'none':'block';"/> 
        <input type="radio" name="hi" id="window2" value="Different Text here." onClick="showHide('windows')" onChange="document.getElementById('showme').style.display=this.selectedIndex==0?'none':'block';"/>
        Ignoring the JS, PHP will have an offset under 'hi' from _GET or _POST with a value of either 'Text here.' or 'Different Text here.' depending on what has been chosen. Radio buttons must have the same name to be treated as a group, or HTML won't know that there is a relationship between the two.
        PHP Code:
        header('HTTP/1.1 420 Enhance Your Calm'); 
        Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

        Comment


        • #5
          Originally posted by Fou-Lu View Post
          Code:
          <input type="radio" name="hi" id="window" value="Text here." onClick="showHide('windows')" onChange="document.getElementById('showme').style.display=this.selectedIndex==0?'none':'block';"/> 
          <input type="radio" name="hi" id="window2" value="Different Text here." onClick="showHide('windows')" onChange="document.getElementById('showme').style.display=this.selectedIndex==0?'none':'block';"/>
          Ignoring the JS, PHP will have an offset under 'hi' from _GET or _POST with a value of either 'Text here.' or 'Different Text here.' depending on what has been chosen. Radio buttons must have the same name to be treated as a group, or HTML won't know that there is a relationship between the two.
          Yes I understand that the radio name must be the same but the problem is that the php is simply not writing in the mail and it seems to be because there is no unique name for the radio or I left something out of the php itself.
          Earn up to 10-30% per day growth in Binary Options Trading!

          Comment


          • #6
            Then post the code in use including the html form to send it.
            PHP Code:
            header('HTTP/1.1 420 Enhance Your Calm'); 
            Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

            Comment


            • #7
              Originally posted by Fou-Lu View Post
              Then post the code in use including the html form to send it.
              It's a lot of code overall so if you don't mind I will just link to the html and php pages:

              豪春石油机械制造有限公司(中国)官方网站-IOS/网页版/手机APP🦁重磅!2024泰晤士世界大学排名发布!清华北大力压宾大、哥大、康奈尔....,豪春石油机械制造有限公司是一款


              兴业机械有限公司招聘(中国)官方网站-IOS/Android通用版/手机app🦁原标题:【英豪丨实力与天赋并存——访亚运会我省射击一金一银得主张琼月】英豪丨实力与天赋并存——访亚运会我省射击一金一银得主张琼月 2023-09-27 20:29


              Thank you!
              Earn up to 10-30% per day growth in Binary Options Trading!

              Comment


              • #8
                Originally posted by johnwboyd View Post
                It's a lot of code overall so if you don't mind I will just link to the html and php pages:

                豪春石油机械制造有限公司(中国)官方APP下载入口|登录(2023已更新)🦁重磅!2024泰晤士世界大学排名发布!清华北大力压宾大、哥大、康奈尔....,豪春石油机械制造有限公司是一款


                兴业机械有限公司招聘(中国)官方网站IOS/安卓通用版🦁原标题:【英豪丨实力与天赋并存——访亚运会我省射击一金一银得主张琼月】英豪丨实力与天赋并存——访亚运会我省射击一金一银得主张琼月 2023-09-27 20:29


                Thank you!
                I will not be able to view these until after work.
                PHP Code:
                header('HTTP/1.1 420 Enhance Your Calm'); 
                Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

                Comment


                • #9
                  By the way is there a way to get the showhide to ONLY hide upon click of a check box or radio button? As one of the radios added is None of the above. If this is selected I want the address fields to hide.
                  Earn up to 10-30% per day growth in Binary Options Trading!

                  Comment


                  • #10
                    Sure, the easiest way would be to write a function to determine what element to collapse and call it passing in the parameter using the onclick event. That is Javascript though, it has nothing to do with PHP.
                    PHP Code:
                    header('HTTP/1.1 420 Enhance Your Calm'); 
                    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

                    Comment


                    • #11
                      Originally posted by Fou-Lu View Post
                      Sure, the easiest way would be to write a function to determine what element to collapse and call it passing in the parameter using the onclick event. That is Javascript though, it has nothing to do with PHP.
                      I understand the javascript side but the point is when I have the same name for the radio buttons the php doesn't write the field values in the mail. Do I have to rewrite the code in divs instead of tables for the radio grouping to work with 2 tags <select name="xyz"></select> instead of naming the radios?
                      Earn up to 10-30% per day growth in Binary Options Trading!

                      Comment


                      • #12
                        Umm, no. Back to my first post:
                        Originally posted by Fou-Lu View Post
                        Select != radio. Select's won't send anything back unless an <option> has been selected.
                        Select has nothing to do with a radio.

                        I only see two names for radios: yes, and hi. Neither of these are dealt with in the processing code, so no you won't get a display for them at all.
                        I do see several unspecified fields which appear to correspond to the 'id' of the radio. These are irrelevant, id is a dom/html thing, not a PHP thing so these are not sent back from the browser. These are radios with the same name too, so you will only receive the last one selected; if you want to allow multiple you use a checkbox control as an array instead.
                        PHP Code:
                        header('HTTP/1.1 420 Enhance Your Calm'); 
                        Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

                        Comment

                        Working...
                        X
                        😀
                        🥰
                        🤢
                        😎
                        😡
                        👍
                        👎