Click to See Complete Forum and Search --> : need help in sending data from formmail.asp to user who fills out form


mikeinchicago
03-27-2006, 10:29 AM
The script I use for mail processing is formmail.asp
You can find it at this link:
http://www.building-envelope.net/formmail.txt

My question is in a generic html form, I need whoever fills out the form, to also receive a copy of the data they filled out, as soon as they hit the submit button. You can find the generic form at this link:
http://www.building-envelope.net/form.html

I know I need to add
"email address" and make it a required field, but how do I get them to receive it, as well as the customer?

Thanks for your help.

Ubik
03-27-2006, 01:56 PM
You could use something like:

<h2>Thank You!</h2>
<p>Here is what you said:</p>
<ul><li>&nbsp;</li>
<%
For Each item In request.form
if IsArray(item) Then
For Each i In item
Response.write("<li>" & item & " : " & Request.form(item) & "</li>")
Next
Else
Response.write("<li>" & item & " : " & Request.form(item) & "</li>")
End if
next
%>
</ul>

mikeinchicago
03-27-2006, 02:08 PM
Thank you, but I have no idea what you mean,. Is there a line of code that you could provide that exactly includes what I need?








You could use something like:

<h2>Thank You!</h2>
<p>Here is what you said:</p>
<ul><li>&nbsp;</li>
<%
For Each item In request.form
if IsArray(item) Then
For Each i In item
Response.write("<li>" & item & " : " & Request.form(item) & "</li>")
Next
Else
Response.write("<li>" & item & " : " & Request.form(item) & "</li>")
End if
next
%>
</ul>

Illufox
03-29-2006, 02:01 PM
This code uploads files and submitted content. It sends an copy of the submission to you and the user.

<%
Set Upload = Server.CreateObject("Persits.Upload")
Upload.ProgressID = Request.QueryString("PID")

' Uncomment this line if unique file name generation is necessary
Upload.OverwriteFiles = False

' We must call Upload.Save or SaveVirtual before we can use Upload.Form!
Upload.Save "c:\UploadDirectory\"

' This is needed to enable the progress indicator

UploadFileCounter = 0
Upload.SetMaxSize 15000000, True '15MB for EACH file.

Server.ScriptTimeout = 360

strBody = "<HTML><BODY>"
strBody = strBody & "<h3>Submission Form</H3>"
strBody = strBody & "The following content has been submitted:<hr>"
strBody = strBody & "<TABLE CELLSPACING=0 CELLPADDING=2 BORDER=1>"
'strBody = strBody & "<TR><TH>Form Item</TH><TH>Value(s)</TH></TR>"
strBody = strBody & "<TR>"
strBody = strBody & " <TD>Email</TD>"
strBody = strBody & " <TD>"
strBody = strBody & Upload.Form("email") & "&nbsp;"
strBody = strBody & " </TD>"
strBody = strBody & "</TR>"
strBody = strBody & "<TR>"
strBody = strBody & " <TD>Phone Number</TD>"
strBody = strBody & " <TD>"
strBody = strBody & Upload.Form("phone") & "&nbsp;"
strBody = strBody & " </TD>"
strBody = strBody & "</TR>"

strBody = strBody & "<TR>"
strBody = strBody & " <TD>Comments</TD>"
strBody = strBody & " <TD>"
strBody = strBody & Upload.Form("comments") & "&nbsp;"
strBody = strBody & " </TD>"
strBody = strBody & "</TR>"

strBody = strBody & "<TR>"
strBody = strBody & " <TD>Number of Files</TD>"
strBody = strBody & " <TD>"
strBody = strBody & Upload.Form("nfiles") & "&nbsp;"
strBody = strBody & " </TD>"
strBody = strBody & "</TR>"


'dim I As Integer
'dim fileNum As Integer
'dim currFile As Integer
fileNum = Upload.Form("nfiles")

For I=1 to fileNum
FileNumber = "File"&I
strBody = strBody & "<TR>"
strBody = strBody & " <TD>File #" & I & "</TD>"
strBody = strBody & " <TD>"
For Each File in Upload.Files
If File.Name = FileNumber Then
strBody = strBody & "Filename = " & File.FileName & " (" & File.Size &" bytes)<BR>"
strBody = strBody & "Click to view: <a href='http://www. yourdomain.com/UploadDirectory/" & File.FileName & "'>"& File.FileName & "</a> <BR>"
End If
Next
strBody = strBody & " </TD>"
strBody = strBody & "</TR>"
Next
strBody = strBody & "</TABLE></HTML>"


Set oMail = Server.CreateObject("CDONTS.Newmail")
oMail.To = "you@yourdomain.com," & Upload.Form("email")
oMail.From = Upload.Form("email")
oMail.Subject = "Submission Form -- Confirmation"
oMail.BodyFormat = 0 'HTML
oMail.MailFormat = 0 'Mime
oMail.Body = strBody
oMail.Send
Set oMail = Nothing
Response.Write "<HTML><HEAD><TITLE>Submission Form -- Confirmation Page</TITLE></HEAD>"
Response.Write "<body><strong>Thank you for your submission.</strong><br><br>"
Response.Write "Your submission has been sent to xxxx. An email confirmation will be sent to you shortly.<br><br>"
Response.Write "Submit successful"
%>