I use this code and send vars to the ASP -> database.
I click only once the submit btn, but I have 2 same records in my database.
What I have wrong?
// bSubmit btn action
var submit_listener:Object = new Object ();
submit_listener.click = function (evt:Object)
{
// send variables to ASP page and save new entry to database
var result_lv:LoadVars = new LoadVars ();
result_lv.onLoad = function (success:Boolean)
{
if (success)
{
trace (mySendVars.toString ());
msg.text = "SENDED.";
}
else
{
msg.text = "NOT Sended.";
}
};
var mySendVars:LoadVars = new LoadVars ();
mySendVars.gname = gname.text;
mySendVars.gmail = gmail.text;
mySendVars.gfrom = gfrom.text;
mySendVars.gmsg = gmsg.text;
//
mySendVars.sendAndLoad ("new_entry_guestbook.asp", result_lv, "POST");
};
bSubmit.addEventListener ("click", submit_listener);