-
Please Help!
I am trying to create a form in flash for people to subscribe to my emaillist. I got someone to create an .asp for me, I just have to implement the actionscripts on the button in flash to have it talk to it. Nothing is working (but i did get dynamic text to work). I don't know what I am doing (or doing wrong) can somebody help?! I'm using Flash 5.
I've created an "editable text" and variable and a button: I just think I might have the script wrong.
I've tried the Get Url (POST):
on (release) {
getURL ("http://66.242.133.142/jcb/addemail.asp ", "Email", "POST");
}
orLoadVariable:
on (release) {
if (!Email.length || Email.indexOf("@") == -1 || Email.indexOf(".") == -1) {
Message = "Please enter a valid E-mail address";
} else {
loadVariablesNum ("http://66.242.133.142/jcb/addemail.asp", "Email", "POST");
Message = "Thank you for subscribing!";
}
}
Can you see what I am doing wrong?
The text form variable is "Email"
can anyone help?!
please.....
-
?
Don't use:
on (release) {
getURL ("http://66.242.133.142/jcb/addemail.asp ", "Email", "POST");
}
Use this instead:
on (release) {
loadVariableNum("http://66.242.133.142/jcb/addemail.asp ", 0, "POST");
}
Hope this helps.
-
Thanks for your help tony.
but when I put that script in and checked to see if any data has been added to my file, it hasn't. hmmm. did i miss something?
also i usually get a browser dialog box when i try to submit something saying it is not secure, auto-entering, etc. is something wrong if no dialog box happens?
also, how does it know to "POST" the email data without a variable reference in the script?
-
?
Originally posted by alantheso
Thanks for your help tony.
but when I put that script in and checked to see if any data has been added to my file, it hasn't. hmmm. did i miss something?
also i usually get a browser dialog box when i try to submit something saying it is not secure, auto-entering, etc. is something wrong if no dialog box happens?
also, how does it know to "POST" the email data without a variable reference in the script?
Of course you have to set up variables first, but it appears from what I can see in your code, it seems that "email" variable is set up.
Did you specify an input textbox as "email"? (in the var box in properties).
Let me know about the above.
I have a similar code that I worked on a project two weeks ago but am currently having a mental blockage so I don't remember what the exact format should be. Unfortunately, it is not on my computer -- will have to wait till Monday.
-
hi tony-
yes the variable in the input text is 'Email'. but do i reference this somewhere else too?! Sorry for my franticness but this website is launching thursday!!
-
Senior Member
I don't know if this would be possible in your case, but when i'm making a flash form to submit something to a server side script I like to make the form in a movie clip to keep the variables I want to send separate from any other variables around the movie.
Create a new clip in frame 1 of the clip put in your input textfields and put your submit button
add a stop(); action to this frame
on the button use
on (release) {
loadVariables("http://66.242.133.142/jcb/addemail.asp", this, "POST");
}
this should send all the variables contained in the movie clip to your asp script. It might also be a good idea to have the asp page return a variable to flash to indicate success or failure of the script. You can do that by having the ASP page write a variable to the page something like (sorry I don't know ASP so i'm not sure hoe you write stuff to the page)
&done=okay&
or
&done=fail&
in the movie clip you can have a frame loop that once the variables have been sent checks the value of the done variable to see whether the script worked or not.
-
?
Code:
on (release) {
loadVariablesNum("insert.asp", 0, "POST");
}
I am thinking... maybe you should not use the http:// bit. Just keep "addemail.asp", e.g.
Code:
on (release) {
loadVariablesNum("addemail.asp", 0, "POST");
}
In addemail.asp file (using VBScript):
Code:
<%@LANGUAGE="VBSCRIPT"%>
' Connection
<% YourDatabase_STRING = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" + Server.mappath("/Databases/db_theDatabase.mdb") %>
<%
myQuery = "INSERT INTO contacts (Email) VALUES ('" & Request("Email") & "' )"
' execute the insert
Set editCmd = Server.CreateObject("ADODB.Command")
editCmd.ActiveConnection = YourDatabase_STRING
editCmd.CommandText = myQuery
editCmd.Execute
editCmd.ActiveConnection.Close
%>
That's it.you maye need to change the mappath depending on your web server. Of course you need to customise the database names and table name in the code here for your own use
To view the contents of the database, create another file, view.asp:
Code:
<%@LANGUAGE="VBSCRIPT"%>
' Connection
<% YourDatabase_STRING = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" + Server.mappath("/Databases/db_theDatabase.mdb") %>
<%
set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = YourDatabase_STRING
Recordset1.Source = "SELECT * FROM contacts"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<HTML><TITLE>What's in the database I wonder?</TITLE><BODY>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<TABLE>
<tr>
<%=(Recordset1.Fields.Item("Email").Value)%>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</TABLE>
<%
Recordset1.Close()
%>
</BODY></HTML>
Most of the database code in ASP files (e.g. SQL, connection, etc.) was easily generated by Dreamweaver Ultra for convinience.
Any queries, feel free to post here.
-
i take it if i do that, the .asp need to be on the same server (and same folder?)
could that also be what was giving me trouble?
-
?
Originally posted by alantheso
i take it if i do that, the .asp need to be on the same server (and same folder?)
could that also be what was giving me trouble?
Possibly. I don't know much about the server itself. But it could be the problem?
Ensure that all files are in the same folder/server. E.g.
SERVER
-- MyFirstWork
---- index.htm
---- flash.swf
---- addemail.asp
---- database.mdb
-- MySecondWork
---- index.htm
---- menu.htm
---- main.htm
---- contacts.htm
-- MyThirdWork
etc.
-- MyFourthWork
etc.
MyXXXWork are folders. In your MyFirstWork folder, you will see all the necessary files are in the same folder.
Hope this helps mate.
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
|