A Flash Developer Resource Site

Page 1 of 3 123 LastLast
Results 1 to 20 of 57

Thread: small Form

Hybrid View

  1. #1
    Senior Member
    Join Date
    Feb 2004
    Posts
    494

    small Form

    How hard is it to do a simple (name,address,phone,text) form in flash? I heard you need a small php script for this, someone help?

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    There are tutorials for almost anything here at Flashkit.

    http://www.flashkit.com/tutorials/Dy...-658/index.php

    ...and yes, you need a serverside script like php,asp or cgi.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Senior Member
    Join Date
    Feb 2004
    Posts
    494

    .

    Ok thanks.

    I did try this and when I hit the send button nothing happens. Ideas? I followed it step by step using php script. I uploaded the script to the same dir as the swf file.

    Arghh

  4. #4
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Does your server support php? Maybe the files need to have their permissions set ( some servers do ).

    The html has to be in the same folder too.

    Its important that the variable names of the textfields are spelled exactly like in the script.

    The php script sjould be uploaded as a text document.

    Also note that the send action...

    loadVariablesNum ("snowMailPHP.php", "0", "Post");

    ...sends all variables located in the MAIN timeline, so thats where the form should be. It also wont work if you have the textfields and submit buttons in different timelines. Or have the form in a movieclip.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  5. #5
    Senior Member
    Join Date
    Feb 2004
    Posts
    494

    ..

    Ok i tried to chmod to 755 no luck. I did look at the flash page and it has the input field on layer 37 and the submit and clear buttons on layer 7. I also the submit button only is a movie clip and the button itself is inside it. I added the actions there. All fields are the same in the script as in the flash action. Ideas?

    Thanks

  6. #6
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    You can try this script ( very simple one ).

    code:

    <?php
    $email ="yourEmail@yourEmal.com";
    $subject = $HTTP_POST_VARS['subject'];
    $message = $HTTP_POST_VARS['message'];
    mail($email, $subject, $message);
    echo "mailstatus=The mail has been sent!&thescript=done&";
    ?>



    ....and make a test fla with just a message ( with variable name message ) field and a submit button....

    on (release) {
    subject = "Testing Mail";
    this.loadVariables("http://www.someSite.com/simplemail.php", "POST");
    }


    ...and see how that works for you.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  7. #7
    Senior Member
    Join Date
    Feb 2004
    Posts
    494

    ..

    Ok I tried this and no go. This is very weird. I have attached what I did to make sure it is right.

  8. #8
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    The button should be on the same timeline as the textfield, not inside a movieclip.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  9. #9
    Senior Member
    Join Date
    Feb 2004
    Posts
    494

    ...

    Ok so just delete it and recreate it in the first timeline?

  10. #10
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Yes, or just copy the button.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  11. #11
    Senior Member
    Join Date
    Feb 2004
    Posts
    494

    ...

    Ok it works. I have a problem though, the text stays there and it does not look like it sends when you click send. I hit it 10 times got 10 e-mails but average person would think it did not work at all. How do I get it to say sent fine and clear the fields out.

    Thanks

  12. #12
    Senior Member
    Join Date
    Feb 2004
    Posts
    494

    closer.....

    I also added more fields, I have name,company,e-mail and message now. I changed the script for this but missed something because it won't work now. this is the script I did. I saw email already in it so I named the variable of the email on the form to email2.

    <?php
    $email ="support@mainsite.com";
    $subject = $HTTP_POST_VARS['subject'];
    $name = $HTTP_POST_VARS['name'];
    $company = $HTTP_POST_VARS['company'];
    $email2 = $HTTP_POST_VARS['email2'];
    $message = $HTTP_POST_VARS['message'];
    mail($email, $subject, $name, $company, $email2 $message);
    echo "mailstatus=The mail has been sent!&thescript=done&";
    ?>


    What am I missing?

    Thanks

  13. #13
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    The only thing I see straight away is a missing , between ....

    $email2 $message

    Dont know if that will make it not work.

    Also the script is missing ....


    <?php


    .. in the beginning which is crucial.

    Im not good with php but the one I posted worked for me. I only use variable names on my textfields, no instance names.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  14. #14
    Senior Member
    Join Date
    Feb 2004
    Posts
    494

    ...

    Nope did not work. I just wanted to add more fields and also when I tried either script when i hit send the text stays I do not get the sent message... This is the script I have on the button now.:

    on (release) {
    subject = "Testing Mail";
    this.loadVariables("http://www.mainsite.com/simplemail.php", "POST");
    }

    and this is the php code:

    $email ="support@mainsite.com";
    $subject = $HTTP_POST_VARS['subject'];
    $name = $HTTP_POST_VARS['name'];
    $company = $HTTP_POST_VARS['company'];
    $email2 = $HTTP_POST_VARS['email2'];
    $message = $HTTP_POST_VARS['message'];
    mail($email, $subject, $name, $company, $email2, $message);
    echo "mailstatus=The mail has been sent!&thescript=done&";
    ?>


    I try this code for php and it works but all i get is the message, and when I hit send nothing says it was sent.


    <?php
    $email ="support@mainsite.com";
    $subject = $HTTP_POST_VARS['subject'];
    $message = $HTTP_POST_VARS['message'];
    mail($email, $subject, $message);
    echo "mailstatus=The mail has been sent!&thescript=done&";
    ?>




    arghhh, Help.

  15. #15
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    The echo is returned to the timeline that sent the variables ( where the button is ), so thats where the textfield called mailstatus has to be ( or textfield thescript if you want to see that too ).

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  16. #16
    Senior Member
    Join Date
    Feb 2004
    Posts
    494

    ..

    so create a textfield with the var name of mailstatu? Do you hide this field?



    Thanks

  17. #17
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Why hide it? Just leave it empty.

    Without a textfield Flash can not diplay any messages.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  18. #18
    Senior Member
    Join Date
    Feb 2004
    Posts
    494

    ...

    Ok I did this but still when I hit submit nothing happens no e-mail recieved and the test stays in the boxes. I have name,company,e-mail and message with submit and clear buttons.

  19. #19
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    I can just say that the mailstatus textfield should be in the same timeline as the send script, and needs to have a variable name of mailstatus for it to work. I dont know why you dont get any emails though ( and strange that you got emails before ( with the message just ) ).

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  20. #20
    Senior Member
    Join Date
    Feb 2004
    Posts
    494

    ...

    Here is the fla and I have the php script below I am using.

    <?php
    $email ="support@mainsite.com";
    $subject = $HTTP_POST_VARS['subject'];
    $name = $HTTP_POST_VARS['name'];
    $company = $HTTP_POST_VARS['company'];
    $email2 = $HTTP_POST_VARS['email2'];
    $message = $HTTP_POST_VARS['message'];
    mail($email, $subject, $name, $company, $email2, $message);
    echo "mailstatus=The mail has been sent!&thescript=done&";
    ?>


    Let me know if there is anything I missed or left out.
    Attached Files Attached Files

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