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.
Printable View
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.
what is loadVariablesNum? try dropping the Num part.
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.
loadVariables("sendmail.php","POST")
Solved below..........
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.
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.
Attachment of FUN file below. You should really try to get yourself using the loadVars class. It's a lot more flexible.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);
?>
IT WORKED! Thanks, dude! That's so awesome!
Why wouldn't it work with a hidden variable, without the dynamic text field?
No worries!
With or without the dynamic text field, your code is working perfectly. I cannot thank you enough for your help!
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.
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?
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']);
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!
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.