Skip to main content
Inspiring
January 8, 2013
Question

having trouble sending vars to database(asp)

  • January 8, 2013
  • 1 reply
  • 1068 views

Hi all, hopefully somebody may be able to help me with a little problem, I am trying to pass variables from flash to a database via asp. Now I know the .asp side of things are working reason being I use the navigateToURL(), which works like a charm, however Im trying to avoid some security issues and avoid it opening up another window. Which brings me to using URLLoader, its getting the variables and "sending them", but Im not getting anything in the database. here is my code for the function.

function sendX(theVar1:String, theVar2:String, theVar3:String, theVar4:String)
{
var url:String = "thewebpage.asp";
var myRequest:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
var myLoader:URLLoader = new URLLoader();
variables.userNm = theVar1;
variables.userLoc = theVar2;
variables.usrRating = theVar3;
variables.custType = theVar4;

myRequest.method = URLRequestMethod.POST;
myRequest.data = variables;

try
{
  myLoader.load(myRequest);
  trace("sucess",variables);
}
catch (e:Error)
{
  trace("fail");
}
}

information is being gathered from 3 txt fields and a button all of which are strings. Like I said have no issues getting the vars, just having them show up in the database. This was also done using a fully qualifed url and the partial with no results. I appreciate any feedback, thanks.

Message was edited by: andjelkovich2012

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
January 8, 2013

if you know your asp page is receiving the variables correctly, the problem is between your asp page and your database.

Inspiring
January 8, 2013

Ok, I can check into that, but do you have any idea why the navigateToURL() is working compared to using URLLOADER? 

kglad
Community Expert
Community Expert
January 8, 2013

show your navigateToURL code so i can see if you're handling your variables the same way.