Storing Flash variables in PHP

29 10 2008

extract take from Dan Netherton http://dnetherton.wordpress.com/2008/10/29/linking-between-php-and-as2/

This morning I was looking through countless tutorials to get a php page to extract variables from Actionscript, finally i have found a working example which will be extremely simple to manipulate for our organism and also make it a little bit better once we have introduced an array or database of some kind.

The example code:

ActionScript:

Btn.onPress = function ()
{
 mail_lv = new LoadVars();
 mail_lv.dummy1 = “”;
 mail_lv.subject = “SSEN CLAN Membership”;
 mail_lv.message = “email_addy”;
 mail_lv.skin = “skin_result”;
 mail_lv.pw = “password”;
 mail_lv.fname = “first_name”;
 mail_lv.lname = “last_name”;
 mail_lv.dummy2 = “”;
 mail_lv.onLoad = function ()
 {
  trace(”Sent successfully…”);
  trace(”mail_lv.subject = ” + mail_lv.subject);
  trace(”mail_lv.message = ” + mail_lv.message);
 }
 mail_lv.send(”
http://localhost/PHP/mail3.php“, “_blank”);
// mail_lv.send(”
http://localhost/PHP/mail3.php“, mail_lv, “POST”);
// loadVariables (”mail.php3″,0,”POST”);
// gotoAndStop (”pg3″)
}

 

and the PHP:

<?php
 if (isset($_POST['subject']))
     $subject = $_POST['subject'];
 
 if (isset($_POST['message']))
     $message = $_POST['message'];
 
 echo(”subject = $subject<BR>”);
 echo(”message = $message<BR>”);
 mail(”
dan.netherton@students.plymouth.ac.uk“, $subject, $message);
?>

 

Next thing to do will be to look at linking Databases (MS Access ones) with the PHP pages to retrieve and update records hopefully…..


Actions

Information

Leave a comment