# Email form using ASP

**URL:** <https://forum.kirupa.com/t/email-form-using-asp/251366>\
**Category:** flash\
**Created:** [February 7, 2008, 6:49pm UTC](https://forum.kirupa.com/t/email-form-using-asp/251366 "2008-02-07T18:49:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dpots](https://avatars.discourse-cdn.com/v4/letter/d/9fc29f/32.png) [@Dpots](https://forum.kirupa.com/u/Dpots)\
**Post date:** [February 7, 2008, 6:49pm UTC](https://forum.kirupa.com/t/email-form-using-asp/251366/1 "2008-02-07T18:49:14Z")

</div>

I am creating a email form in flash. I created a movieclip, named it form and brought it into my main timeline from the library. Within the form is four input text fields with the following variables: name, phone, email, message.

On the main timeline I put my submit button for the form with the following code:

on (release) {  
if (form.name eq “” or form.phone eq “” or form.email eq “” or form.message eq “” ) {  
form.gotoAndStop (3);  
} else {  
form.loadVariables(“contact2.asp”, 1, “POST”);  
form.gotoAndStop (2);  
}  
}

The button functions in that it will go to and stop on the form frame 3 if one of the fields is blank, or it will go to frame 2 of the form movieclip if all the fields are filled as I specified in my code. But does not pass the variables to the ASP page in that I get the email with no variable info passed on.

The submit button is not within the form movieclip itself but rather on the main timeline where the form is located. I tried changing the level on the loadvariables from 1 to 0 but that didn’t make a difference.) But if it is correctly going to the frame 2 and frame 3, I would think the button is speaking to the correct level.

I also did a test in which I replaced form.loadVariables(“contact2.asp”, 1, “POST”);  
with:  
getURL (“contact2.asp”, “”, “GET”);

The url address was a mile long but it DID include the variable info, so I guess it IS passing the variables, but the ASP is not outputting them in the email:  
I did test the ASP using an html form with those variable names and that does work correctly.

Here is the code on the ASP page:

\<%

’ declare variables  
Dim EmailFrom  
Dim EmailTo  
Dim Subject  
Dim name  
Dim email  
Dim phone  
Dim message

’ get posted data into variables  
EmailFrom = "info@mydomain.com"  
EmailTo = "me@yahoo.com"  
Subject = “F22 Website Inquiry”  
Name = Trim(Request.form(“name”))  
Email = Trim(Request.form(“email”))  
Phone = Trim(Request.form(“phone”))  
Message = Trim(Request.form(“message”))

’ validation  
Dim validationOK  
validationOK=true  
If (validationOK=false) Then Response.Redirect(“error.htm?” & EmailFrom)

’ prepare email body text  
Dim Body  
Body = Body & "You have received an inquiry from the Contact page on the F22 website. Below is the information submitted: " & VbCrLf  
Body = Body & " " & VbCrLf  
Body = Body & "Name: " & name & VbCrLf  
Body = Body & "Phone Number: " & phone & VbCrLf  
Body = Body & "Email: " & email & VbCrLf  
Body = Body & "Message: " & message & VbCrLf

’ send email  
Dim mail  
Set mail = Server.CreateObject(“CDONTS.NewMail”)  
mail.To = EmailTo  
mail.From = EmailFrom  
mail.Subject = Subject  
mail.Body = Body  
mail.Send

%\>

Any ideas/input would be greatly appreciated!

Dave
