A Flash Developer Resource Site

Results 1 to 20 of 20

Thread: How do you create forms using MX pro 04' & php

  1. #1
    Junior Member
    Join Date
    Jan 2005
    Posts
    11

    How do you create forms using MX pro 04' & php

    So I have been working on a project for a while and have been trying for days to get the form to work. Nothing is working and I have several questions. The form has 6 input text boxes (name, email, town, year, model, color)

    every reference or tutorial has given me too many answers and nothing works. wish I could just have somebody write it for me so I can copy/paste or a step by step as most of the tutorial and guides are over my head.

    So here are the questions.

    1. Do the input text field need to be on a special layer with all ver name to each box. ( right now my layers are from top to bottom a. actions b. buttons c. elements d. backgrounds)

    2. Do input fields need to be made into a movie.

    3. The Submit button, does it need to be on the same layer as input text.

    4. Is this the correct script for the button. I have a thank you message after you submit.

    --------------------------------------------------

    on (release) {
    if (name eq "" or email eq "" or town eq "" or year eq "" or model eq "" or color eq "") {
    stop();
    } else {
    loadVariablesNum("email3.php", 0, "POST");
    gotoAndStop(2);
    }
    }

    -----------------------------------------------------

    5. my PHP file code, I have no idea how to do this but found some templates and changed them around to what I thought looked correct. Is this correct?

    -------------------------------------------------------

    <?php
    $sendTo = "[email protected]";
    $email = "<".$_POST['email'].">";
    $subject = "Mega Meet Registration";
    $msg = "Name: " . $_POST["name"] . "\r\n";
    $msg .= "Email: " . $_POST["email"] . "\r\n";
    $msg .= "Town: " . $_POST["town"] . "\r\n";
    $msg .= "Year: " . $_POST["year"] . "\r\n";
    $msg .= "Color: " . $_POST["color"] . "\r\n";
    mail($sendTo, $subject, $msg, "From: ".$email);
    ?>

    --------------------------------------------------------------

    The other code for the PHP I did was:

    --------------------------------------------------------------

    <?
    $sendTo = "[email protected]";
    $subject = "Mega Meet Registration.";
    $ip = $_SERVER['REMOTE_ADDR'];
    $headers .= "From: " . $_POST["name"] .">\r\n";
    $headers .= "Reply-To: " . $_POST["email"] . "\r\n";
    $msg = "Name: " . $_POST["name"] . "\r\n";
    $msg .= "Email: " . $_POST["email"] . "\r\n";
    $msg .= "Town: " . $_POST["town"] . "\r\n";
    $msg .= "Year: " . $_POST["year"] . "\r\n";
    $msg .= "Color: " . $_POST["color"] . "\r\n";
    mail($sendTo, $subject, $msg, $headers);
    ?>

    -------------------------------------------------------------

    Can anybody help and tell me how to create and code this as im ready to throw my computer out the window im so frustrated.

    When I did a test, the submit button was present but none of the input text boxes were even visible, could be a layer thing . . . just dont know.

    I just got Flash CS3 so I might just install that and use a tutorial as it seems easier but I hate updating software in the middle of a project incase something goes wrong.

  2. #2
    Junior Member
    Join Date
    Jan 2005
    Posts
    11
    17 views and no answers, come on, please help

  3. #3
    Musical chair sumwungye's Avatar
    Join Date
    Jan 2008
    Location
    Planet Earth, third planet from the Sun
    Posts
    287
    This goes in your flash...

    Code:
    on (release) {
    if (name.length < 1 or email.length < 1 or town.length < 1 or year.length < 1 or model.length < 1 color.length < 1 ) {
    stop();
    } else {
    getURL("email3.php", _blank, "POST");
    gotoAndStop(2);
    }
    }
    This goes in "email3.php"...

    PHP Code:
    <?php
    $sendTo 
    "[email protected]";
    $email "<".$_POST['email'].">";
    $subject "Mega Meet Registration";
    $msg "Name: ".$_POST["name"]."\r\nEmail: ".$_POST["email"]."\r\nTown: ".$_POST["town"]."\r\nYear: ".$_POST["year"]."\r\nColor: ".$_POST["color"]."\r\n";
    mail($sendTo$subject$msg"From: ".$email);
    echo 
    "Thank you. Your e-mail has been sent. You may now close this window.";
    ?>
    The reason loadVariablesNum() doesn't work for this (as far as I know) is because the page isn't open, which is why getURL() should work, because it opens the window. If this doesn't work, let me know.

    I'll be back!
    --SumWunGye

  4. #4
    Junior Member
    Join Date
    Jan 2005
    Posts
    11
    Great, I will plug it in and see, thanks a bunch.

  5. #5
    Junior Member
    Join Date
    Jan 2005
    Posts
    11
    So the code for the submit button has errors, what they are I dont know.

    __________________________________________________ _____________
    **Error** Scene=REGISTRATION, layer=Form, frame=1:Line 2: ')' expected
    if (name.length < 1 or email.length < 1 or town.length < 1 or year.length < 1 or model.length < 1 color.length < 1 ) {

    **Error** Scene=REGISTRATION, layer=Form, frame=1:Line 3: Statement must appear within on handler
    stop();

    **Error** Scene=REGISTRATION, layer=Form, frame=1:Line 4: Unexpected '}' encountered
    } else {

    Total ActionScript Errors: 3 Reported Errors: 3
    __________________________________________________ ____________

    Does the form need to be in a movie clip, right now it is not.
    What about a layer for it, I have a "FORM" layer below the ACTIONS layer and above the BUTTONS layer.

    Im so lost.

  6. #6
    Musical chair sumwungye's Avatar
    Join Date
    Jan 2008
    Location
    Planet Earth, third planet from the Sun
    Posts
    287
    Sorry, missed a less than sign...these silly little things kill people every time.

    Code:
    on (release) {
    	if (name.length<1 or email.length<1 or town.length<1 or year.length<1 or model.length<1 or color.length<1) {
    		stop();
    	} else {
    		getURL("email3.php", _blank, "POST");
    		gotoAndStop(2);
    	}
    }
    --SumWunGye

  7. #7
    Musical chair sumwungye's Avatar
    Join Date
    Jan 2008
    Location
    Planet Earth, third planet from the Sun
    Posts
    287
    Woops, not a less than sign, but an "or." yeah.
    --SumWunGye

  8. #8
    Junior Member
    Join Date
    Jan 2005
    Posts
    11
    Thanks a bunch, looks like it will work.

  9. #9
    Junior Member
    Join Date
    Jan 2005
    Posts
    11
    YUP, it works, thanks you so much, I was trying for days as I dont know coding and was teaching myself . . . what a bad teacher, LOL

  10. #10
    Junior Member
    Join Date
    Jan 2005
    Posts
    11
    One last question now that the form is working.

    I publish with the setting for HTML to be center alignment yet the page displays on the upper left corner. How do i make the site centered in the browser. I know it has to do with HTL but where.

    Here is the HTML flash generated.

    ______________________________________________

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Index</title>
    </head>
    <body bgcolor="#ffffff">
    <!--url's used in the movie-->
    <!--text used in the movie-->
    <!--







    -->
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="1024" height="768" id="Index" align="top">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="movie" value="Index.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#ffffff" />
    <embed src="Index.swf" quality="high" bgcolor="#ffffff" width="1024" height="768" name="Index" align="top" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </object>
    </body>
    </html>

    __________________________________________________ ___________

    Thanks again.

    Also, if anybody want to see the site so far:

    http://www.flmegameet.com/Index.html

    thanks again

  11. #11
    Musical chair sumwungye's Avatar
    Join Date
    Jan 2008
    Location
    Planet Earth, third planet from the Sun
    Posts
    287
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Index</title>
    </head>
    <body bgcolor="#ffffff">
    <!--url's used in the movie-->
    <!--text used in the movie-->
    <!--
    
    
    
    
    
    
    
    -->
    <p align="center"><table border=0 cellspacing=0><tr><td>
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="1024" height="768" id="Index" align="top">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="movie" value="Index.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#ffffff" />
    <embed src="Index.swf" quality="high" bgcolor="#ffffff" width="1024" height="768" name="Index" align="top" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </object>
    </td></tr></table></p>
    </body>
    </html>
    --SumWunGye

  12. #12
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176

    mail form using LoadVars

    loadVariables is "old school" method.

    i have attached a more up to date MX2004 file.

    it first checks if all textfields are filled and the email address is correctly formed,
    if correct, using LoadVars objects with php files, it checks to make sure
    the email address textfield is not trying to send mail from a bogus email domain,
    when all checks are correct, it mails the form details.
    Attached Files Attached Files

  13. #13
    Junior Member
    Join Date
    Jan 2005
    Posts
    11
    Ii can see how as the emails i received had from "XXXX"@panzo.websitewelcome.com" who is that?

    I plugged in and altered the graphics but not the text or code of the file you sent "a mod dog" and it seems better and safer but when i posted and tested my email came back saying it was invalid????

    Check out the site to see.

    Also I tried to have the website center on the page and nothing works.

    I added the line of html coed that sumwungye put in but nothing happens.

    thanks again for all the help so far.

  14. #14
    Musical chair sumwungye's Avatar
    Join Date
    Jan 2008
    Location
    Planet Earth, third planet from the Sun
    Posts
    287
    It wasn't just one line, just try copying the whole thing!
    --SumWunGye

  15. #15
    Junior Member
    Join Date
    Jan 2005
    Posts
    11
    i did copy the whole thing . . . no luck.

    Also it seem your code works better as all me info for email gets called invalid but why does the "from" have "from: [email protected]"
    as the from when I receive a email?

  16. #16
    Junior Member
    Join Date
    Jan 2005
    Posts
    11
    So i went back to sumwungye's code and all works well with center and everything yet when i hit the submit button a blank browser window appears, it used to say "your email has been sent" but i got rid of that line of code yet a "Blank" page is still popping up. I also got rid of the "_blank in the flash sumbit button but it still happens???

  17. #17
    Musical chair sumwungye's Avatar
    Join Date
    Jan 2008
    Location
    Planet Earth, third planet from the Sun
    Posts
    287

    Change the php code to this:

    PHP Code:
    <?php
    $sendTo 
    "[email protected]";
    $email "<".$_POST['email'].">";
    $subject "Mega Meet Registration";
    $msg "Name: ".$_POST["name"]."\r\nEmail: ".$_POST["email"]."\r\nTown: ".$_POST["town"]."\r\nYear: ".$_POST["year"]."\r\nColor: ".$_POST["color"]."\r\n";
    mail($sendTo$subject$msg"From: ".$email);
    echo 
    "Thank you. Your e-mail has been sent. You may now close this window.";
    echo 
    "<script language='JavaScript'>
    window.close();
    </script>"
    ;
    ?>
    --SumWunGye

  18. #18
    Musical chair sumwungye's Avatar
    Join Date
    Jan 2008
    Location
    Planet Earth, third planet from the Sun
    Posts
    287

    Lol Just Kidding

    That won't work. I don't know what to tell you...
    --SumWunGye

  19. #19
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    if using my code, check that all instance names of your textfields
    exactly match those in my code, or it will either fail or mail poor results.

    online test file -
    http://www.jackleaman.co.uk/test/mai...rm_MX2004.html

  20. #20
    Junior Member
    Join Date
    Jan 2005
    Posts
    11
    Well I used Sums code and the window is not coming up anymore . . .ya
    I still dont know why the return emails say "[email protected]"
    Seems like some shady stuff but i dont care anymore as I done more witrh stupid forms then I ever wanted. If people are getting there email address for a reason tuff . . . there are to many things to pay attention to in coding . . . it aint for me.

    I hope im finished

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