Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Help with a Flash Contact Form

    I'm new to this flash and .php thing and I don't know whether this goes into the flash section or the php section. Anways I'm trying to get a flash contact form to work. Here is the AS for the movie clip

    Code:
    onClipEvent(mouseDown){
    
    var senderLoad:LoadVars = new LoadVars();
    
    
    sender.onRelease = function() {
       senderLoad.tf_1 = tf_1.text; 
       senderLoad.tf_2 = tf_2.text; 
       senderLoad.tf_3 = tf_3.text;
       senderLoad.tf_4 = tf_4.text;
       senderLoad.send("contact.php", "_blank", "POST");
     }
    }

    Here is the .php file.

    Code:
    <?PHP
    
    
    
    
    
    
    
    $to = "myemail";
    $subject = "Hello, I have a question or comment";
    $message = "Name: " . $_POST['tf_1'];
    $message .= "\nEmail: "  . $_POST['tf_3'];
    $message .= "\nState: "  . $_POST['tf_4'];
    $message .= "\n\nMessage: "  . $_POST['tf_2'];
    
    
    ini_set('SMTP', 'relay-hosting.secureserver.net');    //read u need this here for GoDaddy
    
    mail($to,$subject,$message,$headers);
    
    ?>
    The host for the website is GoDaddy and they have their own gdform.php file but I have no idea how to incorporate the AS into the .php file. Here is the gdform.php they give you
    Code:
    <?php
    $request_method = $_SERVER["REQUEST_METHOD"];
    if($request_method == "GET"){
    $query_vars = $_GET;
    } elseif ($request_method == "POST"){
    $query_vars = $_POST;
    }
    reset($query_vars);
    $t = date("U");
    
    $file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;
    $fp = fopen($file,"w");
    while (list ($key, $val) = each ($query_vars)) {
    fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
    fputs($fp,"$val\n");
    fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
    if ($key == "redirect") { $landing_page = $val;}
    }
    fclose($fp);
    if ($landing_page != ""){
    header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
    } else {
    header("Location: http://".$_SERVER["HTTP_HOST"]."/");
    }
    
    
    ?>
    Any help is appreaciated.

  • #2
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    What do you need help with, and whats the problem?
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • Users who have thanked gnomeontherun for this post:

    98stang (03-17-2009)

  • #3
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    The problem is I cannot get the email to work. Nothing gets sent to my email box.

  • #4
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    http://www.kirupa.com/developer/acti..._php_email.htm

    Check that first and try those techniques.

    Then verify that your information is getting sent to PHP.

    So instead of having it mail have it echo out the variables.

    Code:
    <?php
    echo $_POST['tf_1'];
    echo $_POST['tf_3'];
    echo $_POST['tf_4'];
    echo $_POST['tf_2'];
    
    ?>
    And report back if the variables are getting sent to PHP. That way I know if its PHP or AS.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #5
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Well I looked on another forum and a person told me to do this

    Code:
    on (release) {
      
          loadVariablesNum("contact.php", 0, "POST");
           theName = _root.Name.txtName.text
           theState = _root.State.txtState.text
           theEmail = _root.Email.txtEmail.text
           theMessage = _root.Message.txtMessage.text
    }
    it's "_root.movieclipname.textinputname.text." Reason he said this was that my input text boxes each sit on a movie clip, meaning there's 4 movie clips.

    Also on that website, Can I just rename the instance fields instead of selecting them all to make one movie clip?
    Last edited by 98stang; 03-03-2009 at 10:44 PM.

  • #6
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Lets focus on getting the PHP to work first, as it appears not to be working. Have you checked with your host on the proper setup? Do you really need that set_int thing? Or is something else missing?
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #7
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    well the host is GoDaddy. I read on another forum where a user had GoDaddy and GoDaddy sent them an email saying to put that ini_set into the .php file. I pretty sure the .php file works (mine, not the GoDaddy one) because when I open the .php file, I get an email with the subject and such. It just doesn't show what user typed.

  • #8
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Well test the PHP with test variables to verify that it is sending emails first. I want to know that is working before we proceed.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #9
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    the .php is working (tested it) this is the file (it's coded a little different)

    PHP Code:
    <?PHP

    include_once("contact.php");


    if (isset(
    $HTTP_POST_VARS)) { 

    $theName $HTTP_POST_VARS['theName']; 
    $theState $HTTP_POST_VARS['theState']; 
    $theEmail $HTTP_POST_VARS['theEmail']; 
    $theMessage $HTTP_POST_VARS['theMessage']; 

     
    $to "myemail";
     
    $subject "Hello, I have a question or comment";
     
    $message .= "Name: " ."$theName\n\n";
     
    $message .= "State: " ."$theState\n\n";
     
    $message .= "Email: " ."$theEmail\n\n";
     
    $message .= "Message: " ."$theMessage\n\n"



    ini_set('SMTP''relay-hosting.secureserver.net');

    mail($to,$subject,$message);

    ?>

  • #10
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Ok good, then we can work on the AS.

    First, check that you have variable names (Not Instances!) and these should match your PHP like theName and theEmail. Then you can use the code from the other person, or just this should also work since you will have the variables set and won't need to grab the text field values.

    Code:
    on (release) {
      loadVariablesNum ("contact.php", 0, "POST");
     }
    }
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #11
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    it still sending the email without what the user typed. I check the variable names and they are correct. Also checked the names on the .php file and they are correct.

  • #12
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Are you using this script or what I said?

    Code:
    on (release) {
      
          loadVariablesNum("contact.php", 0, "POST");
           theName = _root.Name.txtName.text
           theState = _root.State.txtState.text
           theEmail = _root.Email.txtEmail.text
           theMessage = _root.Message.txtMessage.text
    }
    What kind of form element is theMessage? Are you sure it is within a movieClip called Message with the instance name of txtMessage?

    By the way, you should always put ; at the end of each set of commands.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #13
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    basically the input boxes are sitting on top of the movie clips. Also does it matter the the movie clips(the ones under the input boxes) are sitting on a movie clip?


    Here is the website. Click on Contact to see the form I'm talking about.
    http://www.wantedeyewear.com

  • #14
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Yes but what is the code you finally settled on using?
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #15
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Contact Form Solved

    problem solved
    Last edited by 98stang; 03-17-2009 at 08:48 PM.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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