dougevans
05-26-2010, 08:16 PM
Hello All,
I am using the sendAndLoad class to perform a script through PHP and load the variables back into the swf. Using Firefox Firebug, I am able to tell that everything is executing correctly, including the PHP script returning the following variables:
&mySubscriberID=36&firstName=Bill
But the variables are not making it back into the swf file. Here is the code for the first frame of my flash file:
stop();
var sendLV = new LoadVars();
var recLV = new LoadVars();
recLV.onLoad = function(success:Boolean){
trace("recLV back from php");
}
sendLV.onLoad = function(success:Boolean){
nextFrame();
trace("sendLV back from php");
}
sendLV.sendAndLoad("connect7a.php",recLV);
and here is frame 2:
stop();
recLV.createTextField("t_txt", 1, 100, 100, 1, 1);
recLV.t_txt.autoSize = true;
recLV.t_txt.text = "My email address is " + recLV.emailaddress + ".\n";
recLV.t_txt.text += "My subscriber id is " + recLV.mySubscriberID + ".\n";
recLV.t_txt.text += "My first name is " + recLV.firstName + ".\n";
And here is the PHP code:
<?php
$emailaddress='bill@mydomain.com';
$dbhost='localhost';
$username='myuser';
$password='mypass';
$database='mydb';
$conn = mysql_connect($dbhost,$username,$password) or die ('Error connecting to mysql');
mysql_select_db($database) or die ('Unable to select database');
$result = mysql_query("SELECT * FROM email_list_subscribers WHERE emailaddress='$emailaddress'")
or die(mysql_error());
$row = mysql_fetch_array( $result );
$subscriberid = $row['subscriberid'];
$sql = 'SELECT * FROM email_subscribers_data WHERE subscriberid = "' . $row['subscriberid'] . '"';
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
if($row['fieldid']==2) {
$fname = $row['data'];
echo "&mySubscriberID=$subscriberid&firstName=$fname";
}
}
?>
I also have dynamic text fields with the above variables assigned to them. Any ideas on why the swf is not receiving the data? ANY help at all would be appreciated. Thanks in advance!
I am using the sendAndLoad class to perform a script through PHP and load the variables back into the swf. Using Firefox Firebug, I am able to tell that everything is executing correctly, including the PHP script returning the following variables:
&mySubscriberID=36&firstName=Bill
But the variables are not making it back into the swf file. Here is the code for the first frame of my flash file:
stop();
var sendLV = new LoadVars();
var recLV = new LoadVars();
recLV.onLoad = function(success:Boolean){
trace("recLV back from php");
}
sendLV.onLoad = function(success:Boolean){
nextFrame();
trace("sendLV back from php");
}
sendLV.sendAndLoad("connect7a.php",recLV);
and here is frame 2:
stop();
recLV.createTextField("t_txt", 1, 100, 100, 1, 1);
recLV.t_txt.autoSize = true;
recLV.t_txt.text = "My email address is " + recLV.emailaddress + ".\n";
recLV.t_txt.text += "My subscriber id is " + recLV.mySubscriberID + ".\n";
recLV.t_txt.text += "My first name is " + recLV.firstName + ".\n";
And here is the PHP code:
<?php
$emailaddress='bill@mydomain.com';
$dbhost='localhost';
$username='myuser';
$password='mypass';
$database='mydb';
$conn = mysql_connect($dbhost,$username,$password) or die ('Error connecting to mysql');
mysql_select_db($database) or die ('Unable to select database');
$result = mysql_query("SELECT * FROM email_list_subscribers WHERE emailaddress='$emailaddress'")
or die(mysql_error());
$row = mysql_fetch_array( $result );
$subscriberid = $row['subscriberid'];
$sql = 'SELECT * FROM email_subscribers_data WHERE subscriberid = "' . $row['subscriberid'] . '"';
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
if($row['fieldid']==2) {
$fname = $row['data'];
echo "&mySubscriberID=$subscriberid&firstName=$fname";
}
}
?>
I also have dynamic text fields with the above variables assigned to them. Any ideas on why the swf is not receiving the data? ANY help at all would be appreciated. Thanks in advance!