Passing / Storing Variables PLLLLEEEASE HELP!

Hey folks,

I am soooo close to finishing my first AS3 site but I have a niggeling problem which has meant I have done nothing in days and I would really appreciate some help if possible.

I would like to have a multiple page form on the main timeline which is communicating to a php form. I am toiling to understand how to collate my variables from each page (or frame). The other thing i would like to do is have the function that if a visitor clicks back, the information inputed into the form is still visible or re-appears.

Below is a copy of my working code for my 1 page contact form which I can get my head around. If anyone could explain the process or send me in the right direction i’d be sooooooooooooooooo gratefull.

Thanks a million folks


stop();

import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
// ----------------------------------------------------------------
var variables:URLVariables = new URLVariables();
// Be sure to change this URL to the PHP parse file on your site server
var varSend:URLRequest = new URLRequest("http://www.********.netau.net/Form/contact_parse.php");
var varLoader:URLLoader = new URLLoader;
varSend.method = URLRequestMethod.POST;
varSend.data = variables;

status_txt.text = "";

submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);


function ValidateAndSend(event:MouseEvent):void{
    
    //validate form fields
    if(!name_txt.length) {
        status_txt.text = "ERM, WE ARE GOING TO NEED YOUR NAME PLEASE.";    
    } else if(!email_txt.length) {
        status_txt.text = "CAN WE GET YOUR EMAIL ADDRESS PLEASE!";
    } else if(!validateEmail(email_txt.text)) {
        status_txt.text = "OOPS,THATS NOT A PROPER E-MAIL ADDRESS";
    } else if(!msg_txt.length) {
        status_txt.text = "OOPS, PLEASE ENTER A MESSAGE";
    } else {
        
 status_txt.text = "THANKS " + name_txt.text + ",YOUR MESSAGE HAS BEEN SENT, WE'LL GET IN TOUCH ASAP!";
        
          variables.userName = name_txt.text;
           variables.userEmail = email_txt.text;
           variables.userMsg = msg_txt.text;
        variables.userName = name2_txt.text;
           variables.userEmail = email2_txt.text;
           variables.userMsg = msg2_txt.text;
        
        
           varLoader.load(varSend);

        gotoAndStop(2);
        
    }
}

function validateEmail(str:String):Boolean {
    var pattern:RegExp = /(\w|[_.\-])[email protected]((\w|-)+\.)+\w{2,4}+/;
    var result:Object = pattern.exec(str);
    if(result == null) {
        return false;
    }
    return true;
}