Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending email with php and flash 8

Status
Not open for further replies.

lastingforhours

Programmer
Dec 29, 2004
49
US
i have a project im making a flash version 8 a lot of my code will only work in flash 8. one important thing in this project is sending an email via php. nothing is wrong with my php file, ive tested enough to figure that out, so...

i have 2 input fields in flash with var names of email and name.

then the user clicks submit and this code is executed...
loadVariablesNum("myfile.php", 0, "POST");

this will run the php file, but won't post the variables and i THINK its because its published for version 8. so is there something else i can possibly do to esnd emails in flash 8?
 
You have to tell it what variable to Post. In other words the variables must be defined in the same actionscript block as the loadVariablesNum block. A better way to do it would be to use the LoadVars class.

Code:
function sendVars(){
myLoadVars = new LoadVars();
myLoadVars.var1 = textBoxInstanceName1.text;
myLoadVars.var2 = textBoxInstanceName2.text;
myLoadVars.onLoad = function(success){
    if (success){
        trace("file sent");
    }
}
myLoadVars.SendAndLoad("myFile.php",myLoadVars,"POST");
}

buttonName.onRelease = sendVars;

The onload portion of the code above is if you want to send a variable back to flash to confirm that the action was taken successfully.

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
ah, thank you. i actually figured out exactly what you just told me about 30 minutes ago. problem was in fact that my variables were'nt in the same actionscript block - stupid me. thanks though!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top