Sending Variables To ASP From Flash

Jubbas tute was great on PHP and Flash. Let’s clear up any question with ASP and Flash, as I have seen a few messages regarding this matter as of late.

Part 1
Sending variables to ASP and printing them

Create a form in flash containing 4 textboxes. Make one multiline.
Variable names should be:
name
email
website
comments

Create a submit button and apply these actions to your timeline
[AS]
submit.onRelease = function(){
getURL(“http://www.delusionalfx.com/sendmail.asp",0,"post”);
}
[/AS]

Now your all done with the flash, let’s move on to the ASP file.
Save this file as sendmail.asp

What we are doing here is pretty simple. We are requesting the variables values from flash and printing them.


<% @Language=VBScript %>

<% 
name = Request.Form("name")
email = Request.Form("email")
website = Request.Form("website")
message = Request.Form("comments")
%>

<%=name%><br>
<%=email%><br>
<%=website%><br>
<%=comments%><br>


“<%=” is short for saying Response.Write

Alrighty there is part one, let’s move on to the next section

Part 2
Sending captured variables to an email



<% @language="VBSCRIPT" %> 
<%

Dim myMail, myBody

myBody = "Name: "& request.form("name") & vbcrlf
myBody = myBody & "Email: "& request.form("email") & vbcrlf
myBody = myBody & "Website: "& request.form("website") & vbcrlf
myBody = myBody & "Message: "& vbcrlf & request.form("comments")

Set myMail = CreateObject("CDONTS.NewMail")

myMail.BodyFormat=1
myMail.MailFormat=1
myMail.From=request.form("email")
myMail.To=request.form("email")
myMail.Subject="Flash MX Test Email"
myMail.Body=myBody
myMail.Send

set myMail=nothing

%>

There ya go, sorry I have to run, I will give a full explanation of
this code when I get home

btw. I wrote this for Alleen. I def will edit later!

When are you going to clean this up. I don’t understand your last post. Is that PHP script supposed to go in sendmail.asp also?

that is not a php script, i use the php tags to embed the code.

that is the asp file. what do you need to be cleared up?

interesting… :slight_smile:

you might wanna write this up in a tutorial form so we can have it in the tutorials section if you don’t mind :slight_smile:

yea that would be cool, that was my orginal thought, let me clean it up a bit

Ok so both of the php tags go in the asp script?

no copy and paste this, the php tags are here because that is the only way to show code on the FORUM page. if yu don’t wrap the code around those tags, the code will try to execute.

copy and paste, save as sendmail.asp

<% @language=“VBSCRIPT” %>
<%

Dim myMail, myBody

myBody = "Name: "& request.form(“name”) & vbcrlf
myBody = myBody & "Email: "& request.form(“email”) & vbcrlf
myBody = myBody & "Website: "& request.form(“website”) & vbcrlf
myBody = myBody & "Message: "& vbcrlf & request.form(“comments”)

Set myMail = CreateObject(“CDONTS.NewMail”)

myMail.BodyFormat=1
myMail.MailFormat=1
myMail.From=request.form(“email”)
myMail.To=request.form(“email”)
myMail.Subject=“Flash MX Test Email”
myMail.Body=myBody
myMail.Send

set myMail=nothing

%>

well i just screwed up this entire thread by not wrapping the code in the php tags

can a mod help please! :slight_smile:

here is the code again, wow i can’t belivee i screwed this up, grr im so mad, it took me a while to write too… :frowning:


<% @language="VBSCRIPT" %> 
<%

Dim myMail, myBody

myBody = "Name: "& request.form("name") & vbcrlf
myBody = myBody & "Email: "& request.form("email") & vbcrlf
myBody = myBody & "Website: "& request.form("website") & vbcrlf
myBody = myBody & "Message: "& vbcrlf & request.form("comments")

Set myMail = CreateObject("CDONTS.NewMail")

myMail.BodyFormat=1
myMail.MailFormat=1
myMail.From=request.form("email")
myMail.To=request.form("email")
myMail.Subject="Flash MX Test Email"
myMail.Body=myBody
myMail.Send

set myMail=nothing

%>

Maybe I’m asking a stupid question (actually I got this feeling that i’m sure I am)
but how do you get this to e-mail this information to you?

myMail.cc=request.form(“Your email here”)