A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: loadVariablesNum --> PHP help needed!

  1. #1
    Member
    Join Date
    Mar 2006
    Posts
    47

    loadVariablesNum --> PHP help needed!

    I'm not getting too much help in the Actionscript forum on this topic:

    http://www.flashkit.com/board/showthread.php?t=681568

    Maybe someone more in Koolmoves can help. Just trying to send some variables from my Actionscript to PHP.

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    what is loadVariablesNum? try dropping the Num part.

  3. #3
    Member
    Join Date
    Mar 2006
    Posts
    47

    It should be so simple...

    Just tried it, as I read in another thread that KM doesn't support loadVariablesNum. Or at least it didn't work in some version.

    I've added the .fun and .php file again, maybe that will help a bit.

    You'll notice most variables are hard coded in the PHP script at the moment, I'll move on when the Subject works along nicely.

    I desperately need this script to work. It's the final component I need for my website.
    Attached Files Attached Files

  4. #4
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    loadVariables("sendmail.php","POST")

  5. #5
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    Solved below..........
    Last edited by Chris_Seahorn; 04-06-2006 at 07:21 PM.

  6. #6
    Member
    Join Date
    Mar 2006
    Posts
    47
    Is this clause correct in the PHP file:
    $Subject = $_POST['Subject'];

    As I understand, this is supposed to fetch the variable "Subject" from my AS.

    Tried loadVariables("sendmail.php","POST"), it does nothing at all now.

  7. #7
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    This was tested OK. I have it write the POST variables to text so I could test locally without actually firing the mail. Just drop the text writing from the PHP once you have your routine where you want it.

    Code:
    <?php
    $ToName = "Josef van Niekerk";
    $ToEmail = "...@...";
    
    $FromName = "Mr.T";
    $FromEmail = "...@...";
    
    $Subject = $_POST['mysubject'];
    $Message = "This is only a test!!! :)";
    
    mail("$ToName <$ToEmail>", "$Subject", "$Message", "From: $FromName<$FromEmail>");
    
    //this section writes a text file to confirm variables sent..remove if not needed
    $test ="$ToName <$ToEmail>";
    $test .="$Subject";
    $test .="$Message";
    $test .="From: $FromName<$FromEmail>";
    $file= fopen("testmail.txt", "w");
    
     fwrite($file, $test);
     fclose($file);
    
    ?>
    Attachment of FUN file below. You should really try to get yourself using the loadVars class. It's a lot more flexible.

  8. #8
    Member
    Join Date
    Mar 2006
    Posts
    47
    IT WORKED! Thanks, dude! That's so awesome!

  9. #9
    Member
    Join Date
    Mar 2006
    Posts
    47
    Why wouldn't it work with a hidden variable, without the dynamic text field?

  10. #10
    Member
    Join Date
    Mar 2006
    Posts
    47
    No worries!

    With or without the dynamic text field, your code is working perfectly. I cannot thank you enough for your help!

  11. #11
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    It would. I just used the textfield out of habit since that was the only actual POST variable. You could declare it and then POST it.

  12. #12
    Member
    Join Date
    Mar 2006
    Posts
    47
    I notice that when my variables inside the PHP script, for ex. mysubject has any capitals in it, it fails to work.
    Use
    $Subject = $_POST['mysubject'];
    and not
    $Subject = $_POST['mySubject'];
    is this PHP convention?

    Also, how do I remove the \ slashes before some special characters?

  13. #13
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    Well....Subject I've always treated as a reserved word. Notice I used "mysubject".

    To strip slashes or add slashes in a posted variable you could use:

    $Subject = stripslashes($_POST['mysubject']);
    $Subject = addslashes($_POST['mysubject']);

  14. #14
    Member
    Join Date
    Mar 2006
    Posts
    47
    Thanks, got stripslashes working. And Subject being a reserved word, I'm not suprised. Why didn't I think of that from the start.

    Thanks again for your help!

  15. #15
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    No sweat man. In your free time check out the loadVars class. It is much cooler , more flexible and is perfect when the response from your PHP file is needed in instances of confirmation or similar.

    Anyway I can help...stop by the site.

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