PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
AS 2 contact form
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: contact form

  1. #1
    Member
    Join Date
    Jun 2003
    Location
    sunny SoCal
    Posts
    76

    Cow Icon contact form

    I have a template that was purchased online that I am trying to customize. I'm having trouble getting the contact form to work. here's the code for the flash button:
    Code:
    on (rollOver) {
    	gotoAndPlay("s1");
    }
    on (releaseOutside, rollOut) {
    	gotoAndPlay("s2");
    }
    on (release) {
    	for (i=1; i<_parent.fields_descriptions.length; i++) {
    		if (_parent[_parent.fields_descriptions[i][1]] != undefined) {
    			this[_parent.fields_descriptions[i][1]] = _parent[_parent.fields_descriptions[i][1]]+"&777&"+_parent.fields_descriptions[i][2];
    		}
    	}
    	this.recipient = _parent.rec;
    	getURL("contact."+_parent.serv, "_blank", "POST");
    }
    and here's the php code:

    PHP Code:
    <?
    Error_Reporting
    (E_ALL & ~E_NOTICE);

     while (
    $request current($_REQUEST)) {
         if (
    key($_REQUEST)!='recipient') {
            
    $pre_array=split ("&777&",  $request);
            
    $post_vars[key($_REQUEST)][0]=$pre_array[0];
            
    $post_vars[key($_REQUEST)][1]=$pre_array[1];
        }
        
    next($_REQUEST);
    }



    reset($post_vars);
    $subject="From ".$post_vars['your_name'][0] ;
    $headers"From: ".$post_vars['your_email'][0] ."\n";
     
    $headers.='Content-type: text/html; charset=iso-8859-1';
     
    $message='';
      while (
    $mess current($post_vars)) {
          if ((
    key($post_vars)!="i") && (key($post_vars)!="your_email") && (key($post_vars)!="your_name")) {

             
    $message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";
        }
        
    next($post_vars);
     }

    mail($_REQUEST['recipient'], $subject,  "
    <html>
    <head>
     <title>Contact letter</title>
    </head>
    <body>
    <br>
      "
    .$message."
    </body>
    </html>" 
    $headers);
    echo (
    "Your message was successfully sent!");

    ?>
    <script>
        resizeTo(1000, 800);
    </script>
    I don't know where the email is being sent or how to change it to send it to my email. Where would I insert the recipient? I tried a few things, but it broke the code. I'm not familiar with php and so not sure what to do.

    Thanks!!

  2. #2
    Member
    Join Date
    Sep 2009
    Posts
    57
    It will Properly be best if you kept everything simple by just saving the php file as contact.php and call that form. Your AS code should look like this

    Actionscript Code:
    on (rollOver) {
        gotoAndPlay("s1");
    }
    on (releaseOutside, rollOut) {
        gotoAndPlay("s2");
    }
    on (release) {
        for (i=1; i<_parent.fields_descriptions.length; i++) {
            if (_parent[_parent.fields_descriptions[i][1]] != undefined) {
                this[_parent.fields_descriptions[i][1]] = _parent[_parent.fields_descriptions[i][1]]+"&777&"+_parent.fields_descriptions[i][2];
            }
        }
        getURL("contact.php", "_blank", "POST");
    }

    I am sorry I have been of little help but some web designers do not specify where your email should go. The PHP file should have looked like this.

    PHP Code:
    <?php
    $contact_name 
    $_POST['name'];
    $contact_email $_POST['email'];
    $contact_subject $_POST['subject'];
    $contact_message $_POST['message'];

    if( 
    $contact_name == true )
    {
        
    $sender $contact_email;
        
    $receiver "hostmaster@danielmiguel.fr";//This is where YOUR e-mail normally goes
        
    $client_ip $_SERVER['REMOTE_ADDR'];
        
    $email_body "Name: $contact_name \nEmail: $sender \n\nSubject: $contact_subject \n\nMessage: \n\n$contact_message \n\nIP: $client_ip \n\nFlash";        
        
    $extra "From: $sender\r\n" "Reply-To: $sender \r\n" "X-Mailer: PHP/" phpversion();

        if( 
    mail$receiver"Flash Contact Form - $contact_subject"$email_body$extra ) ) 
        {
            echo 
    "success=yes";
        }
        else
        {
            echo 
    "success=no";
        }
    }
    ?>

  3. #3
    Member
    Join Date
    Jun 2003
    Location
    sunny SoCal
    Posts
    76
    Hi danddleo!

    Thanks for replying. Unfortunately, I'm still having trouble with it. With the code it had in the file, it would open a new tab in my browser that said the message sent successfully, but I wouldn't receive the email. I tried copying and pasting in your code, but it opens a blank page in a new tab with nothing at all in it, and I still don't get any email. I did try adding the
    PHP Code:
    $receiver "myname@mydomain.com"
    to the php code it had, but that didn't work either. (I think I got a 404 file not found error with that) I'm sorry to trouble you, but I don't understand php code and am not really all that experienced at action scripting 2. What am I doing wrong?

    Thanks for the help!

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