Many people who have watched the Sending Mail with PHP tutorial at gotoAndLearn() have emailed me saying that the resulting email content is empty. This was my mistake. The version of PHP that my server is running allows you to just reference your posted information directly. So I just used $email to retrieve that value.
The correct way to do it is to use the $_POST[] syntax to get those values. So for the email you would say $_POST['email'].
If you do that for all of the sent data it should then work.
Sorry about that ![]()
Lee








Lee, this answers the problem I’ve been having lately. However, where does this goe in the PHP script? Below is what I have from your on line example.
Thanks,
Randy
The deadly registered globals!
@ Randy:
When you send data via form to a PHP script it can either be sent via POST or GET (the method call in your form tag). For security reasons most PHP installations have a setting named REGISTERED_GLOBALS turned off, which means that instead of accessing the value of a text field named email in your PHP script by typing $email you need to access it by the $_POST or $_GET arrays. Thereby $email is now $_POST['email']… if the form was set using GET the data would be retrieved by typing $_GET['email'].
Another option is to just add the following at the top of the script:
if (isset($_POST)) extract($_POST);
This will loop through the $_POST array and extract each value setting a variable for each array key, so $_POST['email'] becomes $email. For more information on $_POST, $_GET and extract go to php.net and look through the online documentation.
I’ve been using @extract($_POST) at the top of my scripts, from there on I can just refer to $variable. The biggest catch so far is 188 variables at one submission and it works everytime.
Only thing is, there may not be two different hosts in existence with the exact same server config, so results can vary wildly.
Thanks, Sean. I’m not a PHP guy. I know just enough to be dangerous.
-Randy
go ahead and delete this comment but before you do that, search for “1-59671-185-X” on google and see what you find (specificly the second result) just wanted to give a heads up.
Hi Lee
Firstly, love the goToAndLearn() website… Most useful. Will you be redoing the video tutorial to amend this problem? If not, perhaps you could include a link to this information for future learners.
Cheers
Jim
Well the old one worked for me fine
@ Randy
You’re welcome. For future use I would suggest using the $_POST/$_GET method of reading submitted variables as its far more secure, even though I still see clients using PHP installs with REGISTERED_GLOBALS turned on.
Help,
After a bit of messing about, namely due to needing ini_set adding to the top of my php script I got it working !
However I receive the emails
but the movie jumps to message failed! even when the e mail was actually sent ?
I have attached the PHP script
someone please help as Ive spent long enough on this already
cheers
I guess this post is a little outdated but I found your video and instructions really easy to understand, so that is what I am using!
However, I am having the same problem as Jason H, that the form works as it should and I receive my e-mails, yet it still says “failed”. Solutions? The only difference I can think of is that my email form is a movieclip within my flash file. Does this make a difference?