Welcome, Guest. Please login or register.
Did you miss your activation email?
05/21/12, 03:43
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Server side Scripting and Database Support
| |-+  PHP, Perl, ASP, JSP, CFM (Moderators: Flash-db, Musicman, vesa kortelainen, Ronald Wernecke, Jorge Solis, nothingGrinder)
| | |-+  Variables from Flash form to Email with PHP
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Variables from Flash form to Email with PHP  (Read 2765 times)
patronobis
Server what's that
*
Posts: 1



View Profile Email
« on: 02/08/02, 22:39 »

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.
Logged
Flash-db
Administrator
Systems Administrator
*****
Posts: 1867



View Profile WWW
« Reply #1 on: 02/09/02, 16:46 »

Headers in PHP:

The basic Mail function in php consists of The To Email, the email subject, and the email message.  Everything other then those have to be specified.  In addition these extra parameters must be seperated by a new Line shown as the /n.  On some systems this can be slightly different.

This is the basic Mail function:
mail($to, $subject, $message);  

You can use the headers area to specify and build more complex emails:
mail($to, $subject, $message, $headers);

So if you wanted to add the CC parameter you can specify by adding Cc: as one of the headers.

$headers = "From: $FromName<$FromEmail>\r\n";
$headers .= "Cc: $CCEmail\r\n";

Then add headers to your mail function:
mail($to, $subject, $message, $headers);

This can also be written as:
mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "From:".$FirstName." <".$Email.">\r\n", "Cc:".$CCName." <".$CCEmail.">");

Their are a couple other additional paramters you can add as well.

I'm not certain if I have all of the quotes correct on that above example.  So be sure to either check carefully or use the Other (headers) example.
« Last Edit: 02/09/02, 16:48 by Jeff » Logged

-Jeff.
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything