Results 1 to 2 of 2

Thread: PHP working with XML and Flash

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    From the UK
    Posts
    422

    Question PHP working with XML and Flash

    Hey

    I'm tryin to make a form in Flash and it gets an email from XML and then sends a message to it using PHP.

    My actionscript:

    Code:
    senderLoad.theName = txtName.text;
    senderLoad.theEmail = txtEmail.text;
    senderLoad.theDept = xml.firstChild.childNodes[1].childNodes[cboDept.selectedIndex].attributes.mailbox;
    senderLoad.theMessage = txtMsg.text;
    So the different components on the flash form are put into variables.

    My PHP code:

    Code:
    <?PHP
    
    $to = $theDept;
    $subject = "Contact form query";
    $message = "Name: " .$theName;
    $message .= "\nEmail: " .$theEmail;
    $message .= "\n\nMessage: " .$theMessage;
    
    $headers = "From: $theEmail";
    $headers .= "\nReply-To: $theEmail";
    
    $sentOk = mail($to, $subject, $message, $headers);
    
    echo "sentOk=" .$sentOk;
    
    ?>
    So what is happening (in the first line) is that I want whatever theDept is (should be an email pulled from XML file) to be set as *where* the message needs to be sent to. That is why I have set it to $to variable.

    This is not sending however and I think it is because of that $to line - can anyone advise if the code is right or not?

    Thx

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: PHP working with XML and Flash

    assuming you aren't using register_globals: you haven't defined $theDept, so your $to variable is empty.

    I don't know how you're sending the request to the PHP script.. are you sending a GET request, or a POST request (or if you don't know, you can always just use the $_REQUEST variable)? whichever it is, you should print out your variables (print_r()) to find out.

    I've never used flash for anything other than animation, so the only part I can help you out with is the PHP part. If you haven't got the flash form sending the information to the PHP script correctly, then that's where your problem lies, I suppose.

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