dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Submit Form for Website

  1. #1
    Junior Member
    Join Date
    Dec 2006
    Location
    Arkansas
    Posts
    27

    Question Submit Form for Website

    I have a simple submit form for my real estate site. It is name, email, phone, and message with the reset and submit buttons. I can not for the life of me figure out how to get this to work and send me emails/info requests. Here is the code on my submit button:
    on (rollOver)
    {
    gotoAndPlay("s1");
    }
    on (releaseOutside, rollOut)
    {
    gotoAndPlay("s2");
    }
    on (release)
    {
    var phone_descr = _parent.phone_descr;
    var your_name_descr = _parent.your_name_descr;
    var your_email_descr = _parent.your_email_descr;
    var phone = _parent.phone;
    var message = _parent.message;
    var your_email = _parent.your_email;
    var your_name = _parent.your_name;
    i = 1;
    while (this["field_" + i])
    {
    this["field_" + i] = "";
    ++i;
    }
    _parent.message = "";
    _parent.your_name = "";
    _parent.your_email = "";
    _parent.phone = "";
    }

    My reset is fine, but it is obvious that I am missing something and doing something wrong.

    I need someone to tell me what I am doing wrong and what I can do to fix this. Or, they can help me find a tutorial or article that will help. My script skills are pretty limited and so is my understanding of flash, so all the help someone can give me is appreciated. I would be glad to send the file and let someone fix it if my lack of knowledge is a hinderance.
    Last edited by cybernoles; 08-23-2007 at 01:29 PM.

  2. #2
    Member
    Join Date
    Jun 2007
    Posts
    46
    You can check out what I did on my Flash site for email. Its at

    www.chrisgates.net

    There is a file called email.php that sits in the server dir where the swf file is. The php file is this:

    ------- start code

    <?
    $destination="YOUR EMAIL ADDRESS";
    $name=$_POST['name'];
    $email=$_POST['email'];
    $mes=$_POST['comments'];
    $subject="TEXT OF YOUR SUBJECT LINE" ;
    $mes="Name : $name\n
    Email: $email\n
    Comments: $mes\n";
    mail($destination,$subject,$mes); ?>

    -------- end code

    In the frame of my flash file where the contact form is to be, this line is added to a keyframe:

    ------- start code

    _root.contact_form.loadMovie("contact_form.swf");

    ------ end code

    The "contact_form.swf" flash file has three keyframes in it. Frame 1 has a movie clip with the form fields and has this code on it:

    -------- start code

    stop();
    _root.contact_form.form.name="";
    _root.contact_form.form.email="";
    _root.contact_form.form.comments="";

    -------- end code

    The movie clip form fields' instances are named accordingly. Frames 2 and 3 each have a stop(); on the frames. Frame 1 is a thank you for filling out the form. Frame 3 is a send back to the form if all the fields are not filled out.

    The submit button has this code on it:

    --------- start code

    on (release) {
    if(_root.contact_form.form.nume=="" || _root.contact_form.form.email=="" || _root.contact_form.form.comments==""){
    _root.contact_form.gotoAndStop(3);
    }
    else{
    _root.contact_form.form.loadVariables("email.php", "POST");

    }

    }

    ----------- end code

    I hope this helps. The form on my site works great. I hope I didn't leave any holes in this explanation.

    CG

  3. #3
    Junior Member
    Join Date
    Dec 2006
    Location
    Arkansas
    Posts
    27
    Was your form a separate swf file that you inserted into your site swf or was it one that was integrated in the site. Mine is integrated...no separate file for the form. Also, I have name, email, phone, and comments...would I just add to your displayed code (copy/paste) so it displays phone also.

  4. #4
    Member
    Join Date
    Jun 2007
    Posts
    46
    Yes, the form was a separate sfw file and the main flash file call it. It makes it nice that you can edit the form as needed and not mess with your other, probably larger, flash file.

    And yea, just copy and paste, and add what fields you need. Be sure to name them instance-wise, and deal with them in your php file as well.

  5. #5
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    if you like you can download my flash-php feedback form from my library..hope it helps
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  6. #6
    Member
    Join Date
    Jun 2007
    Posts
    46
    Thanks for the link. Lots of good stuff there. Nice video juke box among them.

    Thx,
    CG

  7. #7
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    your welcome..cheers
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center