11 Replies Latest reply on Jul 16, 2011 9:45 AM by Ned Murphy

    radio buttons and PHP

    bborland2010

      I am having a problem getting radio button data into php and I can not seem to find any answers. My project is simple I have a group of radio buttons, when one is selected and a submit button is pressed I want the data from the radio button to populate the subject line of an email and send it. It sounds simple but I am having a lot of problems figuring it out and would appreciate any help I can get. I am good (not great) with flash, ok with PHP but for some reason this is taking a long time to fugure out. I can make a form work with input fields but not with radio button data.

        • 1. Re: radio buttons and PHP
          Ned Murphy Adobe Community Professional & MVP

          What you could do is populate a variable or textfield with the radio button selection information and process it like you would any field.

          1 person found this helpful
          • 2. Re: radio buttons and PHP
            bborland2010 Level 1

            That is what I have been trying and I think is what is my hang up. I populate a text field with the data from the radio buttons data field but I do not know the code needed to properly get it the text fields data into the php file. I have the text field setup with a var name and I am still having problems.

            • 3. Re: radio buttons and PHP
              Ned Murphy Adobe Community Professional & MVP

              Use variables, not the text field var option from the Properties panel... not a reliable resource.  Give the textfield an instance name and use its text property to assign the value to a variable.

               

              I haven't dealt with AS2 to PHP much, but are you using the LoadVars class to manage getting the data to the PHP file?  I think the send() or sendAndLoad() methods are what you want to use.

               

              If you search Google using "AS2 LoadVars" you are likely to find a number of helpful tutorials, including those that focus on PHP being in the picture.

              1 person found this helpful
              • 4. Re: radio buttons and PHP
                bborland2010 Level 1

                Thanks Ned, I really appreciate all your help. I was trying the loadVars but I am going to try and look up the sendAndLoad script. Thanks again.

                • 5. Re: radio buttons and PHP
                  bborland2010 Level 1

                  Hey Ned is there a way to have the subject line fill using a text field? If I use this:

                   

                  getURL("mailto:email.com&subject="dynamic or input text here");

                  • 6. Re: radio buttons and PHP
                    Ned Murphy Adobe Community Professional & MVP

                    You can do what you want but not the way you did it... close though.  You do not put quotes in the middle of the url/query and you do not start off the url query string with an ampersand (&).  Use a question mark (?) to identify the start of the query string.  Ampersands are used to identify separate arguments of the string.

                     

                    getURL("mailto:nobody@adobe.com?subject=dynamic or input text here&body=this is the message");

                    • 7. Re: radio buttons and PHP
                      bborland2010 Level 1

                      Sorry about that, the quotes in the middle were me trying to show you where I wanted to insert the text field data (I know how to make thatline of code work). This is what I really meant to say. I have a 4 of radio buttons with the name of school, the radio button data is the schools name. when someone selects a radio button and clicks submit I have 2 text fields I load,one is filled with "Thank you for your submission" and the other is the radio button data (name of the school),my code looks like this:

                       

                      on (release) {
                          var choice:Number = MiddleSchoolGroup.selectedData;
                          var mSchoolPick = MiddleSchoolGroup.selectedData;
                          var mThankYou = "Thank you for your submission.";
                          mSubmit_btn._visible = false;

                      }

                       

                      My question is,can I now take the mSchoolPick data from the text field and somehow load it into this:

                       

                      getURL("mailto:nobody@adobe.com?subject=mSchoolPick&body=this is the message");

                      • 8. Re: radio buttons and PHP
                        Ned Murphy Adobe Community Professional & MVP

                        Yeah, that was a misleading posting.  Just so that it is clearer the next time around, why don't you take a try at coding it yourself and if it doesn't work, then post that in a new posting.

                        • 9. Re: radio buttons and PHP
                          bborland2010 Level 1

                          yeah I'm sorry about that for some reason I got into this quotation thing yesterday while emailing and I carried it over to this post. As far as the question though, can I use that text field to fill that subject area? I am also trying to make it work with a if/ else statement, I do not know why I am having such a hard time with this. I never tried this before but it doesn't seem like it should be this difficult.

                          • 10. Re: radio buttons and PHP
                            Ned Murphy Adobe Community Professional & MVP

                            If you give the textfield an instance name you can acquire whatever is in the textfield via its text property (ex: tFieldName.text).  To buuild it into a String value you would use... "some text"+tFieldName.text+"some more text"

                            1 person found this helpful
                            • 11. Re: radio buttons and PHP
                              bborland2010 Level 1

                              Thanks again Ned, you rock!