Linking Between PHP and AS2

29 10 2008

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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.