A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [F8] Send vars to PHP

  1. #1
    Member
    Join Date
    Nov 2003
    Location
    Ontario, Canada
    Posts
    80

    [F8] Send vars to PHP

    I have the following in my F8 AS 2.0:

    PHP Code:
    getURL("email.php?sName=" _root.form.contactName.text +
                   
    "&subject=" _root.form.contactSubject.getSelectedItem().data +
                   
    "&email=" _root.form.contactEmail.text +
                   
    "&message=" _root.form.contactEmail.text,"_blank","POST"); 
    and this in my php:
    PHP Code:
    $name $_POST['sName'];
        
    $email $_POST['email'];
        
    $subject $_POST['subject'];
        
    $message $_POST['message"']; 
    but when I echo teh variable names, I get noghing.

  2. #2
    Senior Member Alluvian's Avatar
    Join Date
    Jun 2006
    Posts
    967
    Because you are not sending POST data. POST data is sent along with a url, but NOT in the url itself. If the data is in the url itself, like you are sending here with flash, then you need to use GET to access them.

    Replace $_POST with $_GET and try it.

  3. #3
    Senior Member caroach's Avatar
    Join Date
    Nov 2002
    Location
    Chicago, IL
    Posts
    374
    try using sendAndLoad rather than getURL...this way you can set up your php to send a confirmation back to flash, and it won't open another window
    moo

  4. #4

  5. #5
    Member
    Join Date
    Nov 2003
    Location
    Ontario, Canada
    Posts
    80
    Ok That worked, I have no changed it to:
    PHP Code:
    var sendData = new LoadVars();
            var 
    recieveData = new LoadVars();               
            
    sendData.subject _root.form.contactSubject.getSelectedItem().data;
            
    sendData.sName _root.form.contactName.text;
            
    sendData.email _root.form.contactEmail.text;
            
    sendData.messageText _root.form.contactMessage.text;
            
    sendData.sendAndLoad("email.php",recievedData,"POST"); 
    how shoudl I code my php?

  6. #6
    Member
    Join Date
    Nov 2003
    Location
    Ontario, Canada
    Posts
    80
    /bump

  7. #7
    Senior Member caroach's Avatar
    Join Date
    Nov 2002
    Location
    Chicago, IL
    Posts
    374
    your php should be the same at the beginning to receive the vars from flash...just set up a mailTo() function in php and echo a variable that will be sent back to flash.

    this is a good example: http://www.thegoldenmean.com/techniq...mailform1.html
    moo

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