Hey, I’m doing for the first time a form in AS3 / PHP and I’d like to know if the AS3 part of the code is correct:
var loader:URLLoader = new URLLoader();
var req:URLRequest = new URLRequest("contact.php");
var variables:URLVariables = new URLVariables();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
req.method = URLRequestMethod.POST;
var phpPath:String = "http://localhost/S2Design/";
form.send_btn.buttonMode = true;
form.send_btn.addEventListener(MouseEvent.CLICK, sendForm,false,0,true);
function sendForm(evt) {
variables.senderEmail = form.email_txt.text;
variables.senderSub = form.subject_txt.text;
variables.senderMsg = form.message_txt.text;
req.data = variables;
loader.load(req);
}
This is only the ‘hard part’ of the code, without success or loading messages, is this correct ? Are all the variables sent to the contact.php? Or am I missing something?
Tks