-
my Flash to ASP form isn't working...help!!!
I'm clueless when it comes to ASP, but I having to create a contact form for a site I'm working on in Flash. I've done some tutorials but for some reason it simply isn't working. (yes, I do have ASP technology on the server). Here is what I got:
here is what my form looks like. All of the input text fields are in a movie clip called myForm. The fields are labeled:
fname (first name)
lname (last name)
and so forth and so on...
here is what my properties look like for those fields:
This is what my ASP page code looks like:
<%@language = "VBScript" %>
<%
strFirst = Request.Form("fname")
strLast = Request.Form("lname")
strEmail = Request.Form("email")
strMessage = Request.Form("message")
MyPath=Server.MapPath("webcontacts.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & MyPath
SQL = "INSERT INTO contacts (FirstName, LastName, Email, Message) VALUES ('"&strFirst&"','"&strLast&"','"&strEmail&"','"&st rMessage&"')"
conn.Execute(SQL)
%>
Ok,now why isn't this working???? I'm begging for help on this one. Here is a link to the site that the form is currently on (but of course, not working)
Spectrum Productions
-
you need to package all the variable you are sending from flash into a loadVars object and the use it within the send command.
the action for your submit button should be like this:
Code:
on(release){
varsObj = new LoadVar();
varsObj.fname = fname;
varsObj.lname = lname;
...
...
varsObj.send("handler.asp","_self","POST");
}
"I hate when people put quotes in their signatures" -anonymous
-
thanks fakester...
now, I have that code in place, but how would I go about testing to see if the variables are being passed correctly?
-
I would just print them out in your asp page without doing anything else to start with.. you might need to replace the _self with _blank in the code a gave you above while testing.. this will force the asp page to be in a new window.
"I hate when people put quotes in their signatures" -anonymous
-
ok...here is the code on the button and it's not working - no window pops up with the asp page
on(release){
varsObj = new LoadVar();
varsObj.fname = fname;
varsObj.lname = lname;
varsObj.company = company;
varsObj.title = title;
varsObj.email = email;
varsObj.message = message;
varsObj.send("http://specvid.com/processForm.asp","_blank","POST");
gotoAndPlay("thankyou")
}
-
Not sure why the page isnt popping up, but I gave you bad info for part of it.. it is LoadVars() not LoadVar().
this page has some pretty good examples of how to do what you're trying to do..
http://actionscript-toolbox.com/samplemx_loadvars.php
"I hate when people put quotes in their signatures" -anonymous
-
ok cool - I made the correction and I'm getting the window now, however, the page is a "This page cannot be displayed" page. Any ideas? It looks as if the variables are working (kinda) - they are showing up in the url field of the browswer window.
Also, it looks as if PHP is used more than ASP...is that a better option?
Last edited by glowworm; 11-11-2004 at 02:36 PM.
-
if you are using "POST" in your actionscript, the variables shouldnt be showing in the url, "GET" would make it do that.
if you have access to php, use it.. i would choose it over asp every time. It is a very powerful language with concise syntax. There is also incredible documentation and sample code at http://www.php.net.
but that's just my opinion.. (i hate programming with anything microsoft has developed)
"I hate when people put quotes in their signatures" -anonymous
-
Thanks so much for your help Fakester - I finally got it working!
-
ok..now that I have this working, what do I need to ad to this so that my script in some way determines that certain fields have been filled out. I'm guessing some sort of "If/else" script. I want it to give some sort of indication that certain fields are required and it wont send unless those fields have been filled out.
-
Senior Member
the action on my flash-asp email form looks like this:
on (release) {
if (!Email.length || Email.indexOf("@") == -1 || Email.indexOf(".") == -1) {
LoginStatus = "Please enter a valid E-mail address";
} else if (!Pwd.length) {
LoginStatus = "Please Enter your Password";
} else {
loadVariablesNum("login.asp","","POST");
LoginStatus = "Processing.....";
}
}
If you want to make an apple pie from scratch, you must first create the universe. Carl Sagan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|