Note in that we have used loadVariablesNum to "send" variables. We could just as easily have used GetURL but that would mean that our flash file would unload itself to open the PHP document. This way it runs in the background and the user never leaves your base movie.

The POST method is a form of communicate between files. Many of you would be familiar with the GET method which appends data tot he URL call of a file, (file.swf?variable=value). POST also communicates variables, however these variables are sent using hypertext protocol and not in the URL call. This is useful when the data you wish to submit is confidential (you don't want someone's password showing up in the URL!) or if your variables contain data that may cause errors. In this case, we cannot use GET because Flash reads the " " characters before sending off the call and subsequently tries to call a URL with multiple lines, (which obviously won't work).

That's it! Now you can upload both files to a web-server with PHP support and you should have no trouble getting it to work. These files do not require special permission to run and mail() is enabled on all half-decent PHP hosts. Remember that you can't run these files on your local disk unless you are running some sort of web-server with a PHP interpreter.

Thanks to Shai-Tan and massd on Efnet for their help with figuring out alternative ways to pass the damn new line markers!

Jesse Stratford is the Co-Master of ActionScript.org and a freelance Flash developer and teacher. He is based in Australia and enjoys all things Flash.

NB: If you have comments or feedback please feel free to email me, but please do not email me Flash questions; the forums are provided for that purpose and you will get a faster answer by posting you question there.

If you have found this tutorial helpful, I hope that you will take 30 seconds to visit The Hunger Site where, with just one click you can make a free donation of food to a starving person in a third-world country. We do not benefit financially from this action; it is purely an act of charity.
This tutorial is protected by International Intellectual Property Rights laws and may not be reproduced or redistributed in full or part, without the prior written consent of the author. Unauthorized reproduction of this tutorial or its contents may result in prosecution. I've worked hard on this tutorial, please don't steal it.