Hello everyone,
The following is an excerpt of mails between Jeff Hill and myself. I am posting this for the benefit of beginners like me.
I have downloaded your tutorial on sending variables of a Flash form to email using PHP, CGI, ASP. I opted to use PHP. I set up the replica of your example and it worked except for the last command where the PHP sends back variable to Flash EmailStatus text box saying "Complete...". That variable did not show up in Flash (although the mails were sent out with all the variables). Then I changed that line of the PHP script and deleted "_root.Mail.EmailStatus" to "EmailStatus" and the last variable showed up.
Now I want to set up the actual form. I have not connected with the rest of the movie yet, just trying it out independently. It is not sending the email at all
Here is my script
<?
$ToEmail = "
myself@mymail.com";
$ToName = "My Name";
$ToCC = "
myself@my2ndemailaddress.com"
$ToSubject = "Request Form";
$EmailBody = "Sent By: $FirstName\nSendersEmail: $Email\nSenders Address: $Add\nCity: $City\nState: $State\nCountry: $Country\nZip: $Zip\nPhone: $Phone\nFax: $Fax\nCurrency: $Curr\n\nItems Selected:\nItem1: $Rdes1\nID1: $Rid1\nRate1: $Rup1\nQty1: $Rqty1\nAmt1: $Ramt1\nItem2: $Rdes2\nID2: $Rid2\nRate2: $Rup2\nQty2: $Rqty2\nAmt2: $Ramt2\nItem3: $Rdes3\nID3: $Rid3\nRate3: $Rup3\nqty3: $Rqty3\nAmt3: $Ramt3\nIem4: $Rdes4\nID4: $Rid4\Rate4: $Rup4\nqty4: $Rqty4\nAmt4: $Ramt4\nItem5: $Rdes5\nID5: $Rid5\Rate5: $Rup5\nqty5: $Rqty5\nAmt5: $Ramt5\nTotal: $Tot\nMode: $Mod\n";
$EmailFooter="\nThis message was sent by: $FirstName from $REMOTE_ADDR";
$Message = $EmailBody.$EmailFooter;
mail($ToName." <".$ToEmail.">",$ToCC, $ToSubject, $Message, "From:".$FirstName." <".$Email.">");
Print "_root.Mail.EmailStatus=You will receive our Proforma Invoice within 2 business days";
?>
My Flash movie has only 2 lines:
on (release) {
loadVariablesNum ("Amail3PHP.php", 0, "POST");
EmailStatus = "Your form is being sent. Thank you for your interest in our products.";
}
Current Problem:When I go to the website, I can fill up the form, but when I click on the'Submit' button, the mail is not sent. Whereas with your example, it reaches instantly. Can you please let me know where I have gone wrong?
Jeff Hill wrote:....The first problem that I can think of is that you don't have your email fields set up correctly in the mail function: mail($ToName." <".$ToEmail.">",$ToCC, $ToSubject, $Message, "From:".$FirstName." <".$Email.">");
The To Email, Subject and Message all have to follow one another, then the other fields must have a header to specify what each one is, For example PHP will not know that the $ToCC variable is supposed to CC the email to someone else - you'll have to tell it to do that also it's out of order and must come after the Subject and message.
As far as the rest the Path from the Email Movie clip to the script and it's return path is what is causing you the problems with not being able to return the success message - I'll go into that in more detail on the board.
The work around:I deleted the commands and references to CC (in the variable, line3 and from the mail command). Things are working perfectly.
Some Questions:How do I get the 'CC' working?
How do I define positions in the PHP script so that the email shows some of the variables like a 5x5 table?
Cheers.
Abhijit Patronobis.