Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form submit, take entire page

Status
Not open for further replies.

TheCandyman

Technical User
Sep 9, 2002
761
US
I thought i remember reading somewhere where i could take the entire page submitted by a form and with asp put that into a value(for email).

If that's not possible, how do i loop through an entire form grabbing all fields used(text, radio, checkbox)
 
After hunting for my first method without success, I may have to go with just listing the info from the forms:
Code:
for x = 1 to Request.Form.count() 
        table_draw = table_draw & Request.Form.key(x) &" = "& Request.Form.item(x) & "<br>"
next

Then just send an email and include "table_draw". I would still rather send the entire page and not just the form values is anyone knows how to do it.
 
my isp who hosts a website for me, has a cgi program that submits an entire form with field names on the form as email. you may want to check with the web site to see if they do.
 
I run the web server for the company i work for so asking the hosting company isn't an option. I'll have to search around for any cgi that can do that.
 
Does it send the entire page or just the values? Looking through the company's website i don't see this any mentioned anywhere. I already created code that does all of the email, so im just looking for a script that will grab the entire page(not just values) of a submitted form.

 
Not sure why you would want to do this, but If you use CDOSYS to send the email there is an option to send an entire page.

Here's a simple example:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
If Request.QueryString("submit") = "Submit" then

'Get and validate form data
For Each Field In Request.QueryString
TheString = Field & " = Request.QueryString(""" & Field & """)"
Execute(TheString)
if Request.QueryString(Field) = "" then
error_message = error_message & Field & " is blank.<br>"
end if
Next

If error_message = "" then
'Build query string for creating email message
Dim MyForm
MyForm = " For Each Field In Request.QueryString
if field <> "submit" then
MyForm = MyForm & "&" & Field & "=" & Request.QueryString(Field)
end if
Next

'Send email message
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="form@mydomain.com"
myMail.To="me@mydomain.com"
myMail.CreateMHTMLBody MyForm
myMail.Send
set myMail=nothing
Response.Redirect(" End if

Elseif Request.QueryString("populate_mailform") = "true" then
'Populate form for emailing
For Each Field In Request.QueryString
TheString = Field & " = Request.QueryString(""" & Field & """)"
Execute(TheString)
Next

End if
%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<%
if error_message <> "" then
response.write(error_message)
end if
%>
<form action="myform.asp" method="get" name="form1">
<p>Field 1:
<input name="field1" type="text" value="<%= field1 %>" size="5" maxlength="5">
</p>
<p>Field 2:
<input name="field2" type="text" value="<%= field2 %>" size="5" maxlength="5">
</p>
<p> <input name="submit" type="submit" id="submit" value="Submit">
</p>
</form>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top