Many moons later... Izlude rebuilds his flash website on the Canvas, and believe me, this was the biggest headache of the century! It's almost done, I just have 1 thing left... to get the e-card mailing feature working.

Alright, so I don't know how many of you remember that e-card engine that originated here on flashkit so long ago. It's been a real joy using it and seeing others enjoy it, however this year it all has to change.

I've been trying to convert this e-card engine to work on the canvas, however I've had no such luck. I do have leads though... first, here's the actual code we've all been accustom to.

SendEcard php
PHP Code:
register_globals( 'NGPCFRES' );

$CreateEcard = date(U); 
$filename = $CreateEcard.".txt"; 
$ToEmail = $_POST["ToEmail"]; 
$FromEmail = $_POST["FromEmail"]; 
$ToName = $_POST["ToName"]; 
$FromName = $_POST["FromName"]; 
$Greeting = $_POST["Greeting"]; 
$IntroMessage = $_POST["IntroMessage"]; 
$EndMessage = $_POST["EndMessage"]; 
$EcardSelect = $_POST["selected"]; 
$Today = (date ("l dS of F Y ( h:i:s A )",time())); 
$Created = "Ecard Created on $Today"; 
$EcardNum = $_POST['EcardSelect'];
$EcardText = "ToName={$_POST['ToName']}&ToEmail={$_POST['ToEmail']}&FromName={$_POST['FromName']}&FromEmail={$_POST['FromEmail']}&Greeting={$_POST['Greeting']}&IntroMessage={$_POST['IntroMessage']}&Created={$_POST['Created']}&"; 
$fp = fopen( "dBText/$filename","w"); 
fwrite($fp, $EcardText, 10000); 
fclose( $fp ); 
######Email Card######## 
## You can change the subject and the message part around. 
## Make sure to change the Link as stated in the Tutorial. 
## (Change from 'someSite' to your actual site - leave the rest the same 
$ToSubject = "E-card from $FromName"; 
$Message = "$ToName,\nYou have recieved a Flash E-card from $FromName. \nClick the following link to view your card:\n\n$CreateEcard&ENum=$EcardNum\n\n-----------------------------------\nHere is the message that was sent:\n$ToName,\n$Greeting\n$IntroMessage\n\n-$FromName\n\n\n-----------------------------------\nThis card was sent by Bunny and Panda\n\nMaking you smile a little more each time."; 

mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "From: ".$FromName." <".$FromEmail.">"); 

## This next line returns a success message to the movie. 
print "_root.holder.Status=\n Copy the following link to view your card:\n$CreateEcard%26ENum=$EcardNum\n"; 

function register_global_array( $sg ) {
    Static $superGlobals    = array(
        'e' => '_ENV'       ,
        'g' => '_GET'       ,
        'p' => '_POST'      ,
        'c' => '_COOKIE'    ,
        'r' => '_REQUEST'   ,
        's' => '_SERVER'    ,
        'f' => '_FILES'     ,
        'n' => '_SESSION'
    Global ${$superGlobals[$sg]};
    foreach( ${$superGlobals[$sg]} as $key => $val ) {
        $GLOBALS[$key]  = $val;
function register_globals( $order = 'gpc' ) {
    $_SERVER;       //See Note Below
    $order  = str_split( strtolower( $order ) );
    array_map( 'register_global_array' , $order );
In flash, all I would have to do is "loadvariablesnum" function and that's it... piece of cake. Each input textfield in flash had a "variable" and this php read those variables and printed them to the email as well as generated a txt file so that the e-card could also do "loadvariablesnum" and display the values on its dynamic textfields.

On the canvas, I THINK I have to use ajax or load instead eg:

I don't know how to this... looking for help! Now also, I'm thinking that I'm going to have to change the php in some ways. Perhaps it's supposed to generate js files instead of txt from now on? And then the e-card will have to load the generated js file "+filename+".js" type deal.. can't seem to get that working either... need help with that too...

then there's the line:
print "_root.holder.Status=\n Copy the link etc....
how should this work on the canvas if it's printing to dynamic text field? (no change?) or do you think it should be something like:
print "window.parent.this.Status.text=\n Copy the link etc...
(i use window.parent because this whole process is all taking place on an iframe)

And lastly, here's the big one. In flash, the text inputs had variable names that reflect the correct format in the current php. In the canvas, I don't know if I have to change them to reflect how they are in canvas.

ToName, FromName, ToEmail, Greeting, IntroMessage on the canvas are component input text fields and referenced as:
so do I have to change the php to reflect this? Basically asking an experienced person to change it up for me... I know I'll screw up.

I'll only ask that much for now. Once the php actually loads up correctly and sends the email/generates the correct js file, then I'll come back and ask how to make the e-card load the generated js file. Thanks a million everyone!