A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [RESOLVED] new to PHP. contact form question.

Threaded View

  1. #1
    Member
    Join Date
    Feb 2006
    Posts
    96

    resolved [RESOLVED] new to PHP. contact form question.

    I have a simple 3 field contact form written in AS3. I have verified it to the point where I send my data to PHP and it all works as intended.

    However, because of my ignorance of PHP, I am lost when it comes to actually getting Flash and PHP to talk to 1 another. I have been working on this for a day and a 1/2 now and about to pull my hair out!

    My flash collects and stores 3 variables (contactName, contactEmail, contactComments) and then passes them to PHP. I would then like PHP to send an email to a predetermined address and confirm the email was sent. Simple enough, right?

    The code is pieced together from other examples from Flashkit and other sites.

    here is my relevant AS3 code:

    sidenote: PHP version is 5.2.2

    PHP Code:

    var contactVariables:URLVariables = new URLVariables();
    var 
    phpSend:URLRequest=new URLRequest('contact.php');
    var 
    phpLoader:URLLoader=new URLLoader();
    phpSend.method=URLRequestMethod.POST;
    phpSend.data=contactVariables;


    function 
    sendMail():void {
                 
    contactVariables.contactName=contactName;
        
    contactVariables.contactEmail=contactEmail;
        
    contactVariables.contactComments=contactComments;
        
    phpLoader.load(phpSend)    

    PHP Code:
    <?PHP 
    $to
    ="[email protected]";
    $subject="ABC Company Web Contact Form"

    //pass variables

    $name=$_POST['contactName'];
    $email=$_POST['contactEmail'];
    $comments=$_POST['contactComments'];

    if(
    mail($to$subject$comments"Sender: $name)){

    print('&mail=1'); //success

    } else {

    print('&mail=0'); //failure

    }

    ?PHP>
    Last edited by compjock; 11-18-2009 at 03:56 PM. Reason: insert PHP version

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