14 Replies Latest reply on Feb 28, 2007 2:30 PM by SymTsb

    Flash PHP Form

    eLoCas Level 1
      I have a flash based PHP form I am playing around with - the form works great, only one problem. I have 4 variable "name" "email" "phone" and "message" and I want the form to not continue if any of the variable are not filled in.

      This is what I have:

      on (release) {
      if (name eq "" or email eq "" or phone eq "" or message eq "") {
      Stop();
      } else {
      loadVariablesNum("form.php", 0, "POST");
      gotoAndPlay(6);
      }
      }

      Can anyone let me know what I am doing wrong - thanks ;-)
        • 1. Re: Flash PHP Form
          crazyjoemilan Level 2
          don't use loadVariablesNum for trying to communicate back and forth, use loadVars class: sendandload

          the AS dictionary in Flash has a really nice code snippet for this one. see if you can't apply it and I'll show you how to put clauses in for unfilled fields.
          • 2. Re: Flash PHP Form
            eLoCas Level 1
            Okay - I just looked through and read all about "sendandload" in flash and now more confused than I was before. ;-) Actionscripting wise - I am a big novice - I got the script above from a tutorial, so I was very surprised I got that to work as easy as I did. I appreciate your time, but trying to get me to write and understand more than simple actionscripting is a lost cause. ;-)
            • 3. Re: Flash PHP Form
              crazyjoemilan Level 2
              nooooOOOoooooo shoot man, well ifyou want to give it a try, I'd be down to help you out. Remember confusion is the beginning of knowledge.
              • 4. Re: Flash PHP Form
                crazyjoemilan Level 2
                if (name eq "" or email eq "" or phone eq "" or message eq "")

                if (name == "" || email == "" || phone == "" || message == "") {
                //reset something something
                } else {
                //submit form
                }
                • 5. Re: Flash PHP Form
                  eLoCas Level 1
                  What a great saying... "confusion is the beginning of knowledge."

                  Alright, you don't know what you are getting into, at any point feel free to bail, I will totally understand ;-)

                  Alright, I took what you wrote and threw it into the script as below - still going to frame 6 even if boxes are not filled in.

                  on (release) {
                  if (name == "" || email == "" || phone == "" || message == "") {
                  Stop();
                  } else {
                  loadVariablesNum("form.php", 0, "POST");
                  gotoAndPlay(6);
                  }
                  }

                  I know if you have 1 character off it can throw it off - thanks.
                  • 6. Re: Flash PHP Form
                    Sketchsta Level 1
                    Try this...
                    • 7. Flash PHP Form
                      crazyjoemilan Level 2
                      So the set-up with your current code should be each of the text fields have the Variable name as name, email, phone, or message. Make sure its not the instance name, or you'll need to change the code to...

                      name.text == ""

                      Now also make sure you have "stop();" on the frame this is on, or you'll just default play right to the last frame. Then you'll loop actually.

                      If these are all done, and its still behaving wrong, you can find your problem by using the "trace();" function
                      basically, you put tracers on each of the variables to see why it says their values are at null or "". If you can track down where your code is wacky, you can fix it.

                      on (release) {
                      if (name == "" || email == "" || phone == "" || message == "") {
                      trace("THE MESSAGES AREN'T WORKING RIGHT");
                      trace(name);
                      trace(email);
                      trace(phone);
                      trace(message);
                      Stop();
                      } else {
                      trace("IT KICKED TO THE ELSE STATEMENT");
                      trace(name);
                      trace(phone);
                      trace(message);
                      trace(email);
                      loadVariablesNum("form.php", 0, "POST");
                      gotoAndPlay(6);
                      }
                      }
                      • 8. Re: Flash PHP Form
                        eLoCas Level 1
                        Hello - I tried Sketchsta's script and it still didn't work - switched off between making it the variable and the text fields. Then I took the original tutorial original file where the script works and step by step modified it to see exactly where I was going wrong and found the problem - when you set the publish setting for either flash 5 or 6 it works great, but when you set it to flash 7 or 8 that is where it doesn't work like it is supposed to and goes to the next frame when clicking submit even if the fields are not filled in. Weird that is wouldn't work for flash 7 or 8. I would just leave it for 5, but the text looks like crap becuase you can antialias it for readablility only in flash 8 - any suggestions to why this is acting like it is??? - Thanks
                        • 9. Re: Flash PHP Form
                          eLoCas Level 1
                          Also here is a link to the tutorial where I got the original file

                          http://codewalkers.com/tutorials.php?show=10
                          • 10. Re: Flash PHP Form
                            eLoCas Level 1
                            Hey Sketchsta - thanks for the file - it form works great - only had to add the email to the PHP file

                            $EmailBody = "Name: $name\n Number: $number\n\n Email: $email\n Comments: \n $message\n";

                            It wasn't sending the email address to my email - thanks again. Also, McHelpson thank you for your help and time as well.
                            • 11. Re: Flash PHP Form
                              Sketchsta Level 1
                              yeah the email field wasnt getting added to the main body, but its in the reply path so if you were to pres the reply button in your email it would insert the reply address into the To: field.

                              you're welcome.
                              • 12. Re: Flash PHP Form
                                eLoCas Level 1
                                Hey Sketchasta - just wanted to thank you again for pointing me in the direction of that form - I was able to modify the look of it to fit in with the look of the site.

                                If you wanted to take a look at it

                                http://www.flashanimationwebsitedesign.com/

                                Thanks again -E
                                • 13. Re: Flash PHP Form
                                  eLoCas Level 1
                                  Sketchsta - forgot to mention it is under the "project quotes" button.

                                  Thanks -E
                                  • 14. Re: Flash PHP Form
                                    SymTsb Level 2
                                    && is going to additively check to make sure ALL fields are empty. If the user fills in 3 but 1 is empty, the form will still submit. check the fields individually by using ||