469,326 Members | 1,463 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,326 developers. It's quick & easy.

Help with asp website form

I'm used to unix/cgi scripts so im slightly out of my depth here.
Ive got an asp script for a website form which works fine.
What i want to do is also get the form to include the ip address of the
perosn sending the form ie
<input type=hidden name=env_report value=REMOTE_ADDR>
Anyone know how to apply this to this asp script below?:

<%
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
Set MailObject = Server.CreateObject("CDONTS.NewMail")
MailObject.From = "we*****@xxx.com"
MailObject.To = "we*****@xxx.com"
MailObject.Subject = "Form"
MailObject.Body = sBody & vbCrLf

MailObject.Send
Set MailObject = Nothing
' Now redirect
Response.Redirect "http://www.xxx/thank_you.htm"
%>
Jul 19 '05 #1
44 3035
you mean you want to get the literal "REMOTE_ADDR" as the from?

Request.Form("inputNameHere")
will get you what you want, it retrieves the value

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Mike" <me@privacy.net> wrote in message
news:10****************@despina.uk.clara.net...
I'm used to unix/cgi scripts so im slightly out of my depth here.
Ive got an asp script for a website form which works fine.
What i want to do is also get the form to include the ip address of the
perosn sending the form ie
<input type=hidden name=env_report value=REMOTE_ADDR>
Anyone know how to apply this to this asp script below?:

<%
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
Set MailObject = Server.CreateObject("CDONTS.NewMail")
MailObject.From = "we*****@xxx.com"
MailObject.To = "we*****@xxx.com"
MailObject.Subject = "Form"
MailObject.Body = sBody & vbCrLf

MailObject.Send
Set MailObject = Nothing
' Now redirect
Response.Redirect "http://www.xxx/thank_you.htm"
%>

Jul 19 '05 #2
"Mike" <me@privacy.net> wrote in message
news:10****************@despina.uk.clara.net...
I'm used to unix/cgi scripts so im slightly out of my depth here.
Ive got an asp script for a website form which works fine.
What i want to do is also get the form to include the ip address of the
perosn sending the form ie
<input type=hidden name=env_report value=REMOTE_ADDR>
On the ASP page that includes the form, add this (within the form tags):

<%
Response.Write("<input type=""hidden"" name=""env_report"" value=""" &
Request.ServerVariables("REMOTE_ADDR") & """>" )
%>
Anyone know how to apply this to this asp script below?:
You would not need to modify the script below... it iterates through all of
the items in the form.
Hope this helps.
Regards,
Peter Foti

<%
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
Set MailObject = Server.CreateObject("CDONTS.NewMail")
MailObject.From = "we*****@xxx.com"
MailObject.To = "we*****@xxx.com"
MailObject.Subject = "Form"
MailObject.Body = sBody & vbCrLf

MailObject.Send
Set MailObject = Nothing
' Now redirect
Response.Redirect "http://www.xxx/thank_you.htm"
%>

Jul 19 '05 #3

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:ON**************@TK2MSFTNGP09.phx.gbl...
you mean you want to get the literal "REMOTE_ADDR" as the from?

Request.Form("inputNameHere")
will get you what you want, it retrieves the value

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com

tried that but without success. i'm not quite sure where to insert this.
Can you edit my code below so i can see exactly what/where you mean
<%
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
Set MailObject = Server.CreateObject("CDONTS.NewMail")
MailObject.From = "we*****@xxx.com"
MailObject.To = "we*****@xxx.com"
MailObject.Subject = "Form"
MailObject.Body = sBody & vbCrLf

MailObject.Send
Set MailObject = Nothing
' Now redirect
Response.Redirect "http://www.xxx/thank_you.htm"
%>

Jul 19 '05 #4
Also, keep in mind that the reported IP may or may not be the actual
IP, since proxies and NAT can report a different IP.

Jeff
On Wed, 28 Jan 2004 12:41:52 -0500, "Peter Foti"
<pe***@Idontwantnostinkingemailfromyou.com> wrote:
"Mike" <me@privacy.net> wrote in message
news:10****************@despina.uk.clara.net...
I'm used to unix/cgi scripts so im slightly out of my depth here.
Ive got an asp script for a website form which works fine.
What i want to do is also get the form to include the ip address of the
perosn sending the form ie
<input type=hidden name=env_report value=REMOTE_ADDR>


On the ASP page that includes the form, add this (within the form tags):

<%
Response.Write("<input type=""hidden"" name=""env_report"" value=""" &
Request.ServerVariables("REMOTE_ADDR") & """>" )
%>
Anyone know how to apply this to this asp script below?:


You would not need to modify the script below... it iterates through all of
the items in the form.
Hope this helps.
Regards,
Peter Foti

<%
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
Set MailObject = Server.CreateObject("CDONTS.NewMail")
MailObject.From = "we*****@xxx.com"
MailObject.To = "we*****@xxx.com"
MailObject.Subject = "Form"
MailObject.Body = sBody & vbCrLf

MailObject.Send
Set MailObject = Nothing
' Now redirect
Response.Redirect "http://www.xxx/thank_you.htm"
%>


Jul 19 '05 #5
Try:
<%
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

sBody = sBody & "IP Address: " & Request.ServerVariables("REMOTE_ADDR")
''rest of your code
Also, instead of CDONTS, you should be using CDO, unless you're on an NT 4
server. CDONTS is being phased out.
http://www.aspfaq.com/show.asp?id=2026

Ray at home
"Mike" <me@privacy.net> wrote in message
news:10****************@despina.uk.clara.net...
I'm used to unix/cgi scripts so im slightly out of my depth here.
Ive got an asp script for a website form which works fine.
What i want to do is also get the form to include the ip address of the
perosn sending the form ie
<input type=hidden name=env_report value=REMOTE_ADDR>
Anyone know how to apply this to this asp script below?:

<%
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
Set MailObject = Server.CreateObject("CDONTS.NewMail")
MailObject.From = "we*****@xxx.com"
MailObject.To = "we*****@xxx.com"
MailObject.Subject = "Form"
MailObject.Body = sBody & vbCrLf

MailObject.Send
Set MailObject = Nothing
' Now redirect
Response.Redirect "http://www.xxx/thank_you.htm"
%>

Jul 19 '05 #6
Not to mention that by grabbing the value from a form element, it can be
whatever value someone wants it to be then, like if someone created his own
form and posted it. I don't know anyone would want to do that in this
particular example though.

Ray at home

"Jeff Cochran" <jc*************@naplesgov.com> wrote in message
news:40*****************@msnews.microsoft.com...
Also, keep in mind that the reported IP may or may not be the actual
IP, since proxies and NAT can report a different IP.

Jeff
On Wed, 28 Jan 2004 12:41:52 -0500, "Peter Foti"
<pe***@Idontwantnostinkingemailfromyou.com> wrote:
"Mike" <me@privacy.net> wrote in message
news:10****************@despina.uk.clara.net...
I'm used to unix/cgi scripts so im slightly out of my depth here.
Ive got an asp script for a website form which works fine.
What i want to do is also get the form to include the ip address of the
perosn sending the form ie
<input type=hidden name=env_report value=REMOTE_ADDR>


On the ASP page that includes the form, add this (within the form tags):

<%
Response.Write("<input type=""hidden"" name=""env_report"" value=""" &
Request.ServerVariables("REMOTE_ADDR") & """>" )
%>
Anyone know how to apply this to this asp script below?:


You would not need to modify the script below... it iterates through all ofthe items in the form.
Hope this helps.
Regards,
Peter Foti

<%
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
Set MailObject = Server.CreateObject("CDONTS.NewMail")
MailObject.From = "we*****@xxx.com"
MailObject.To = "we*****@xxx.com"
MailObject.Subject = "Form"
MailObject.Body = sBody & vbCrLf

MailObject.Send
Set MailObject = Nothing
' Now redirect
Response.Redirect "http://www.xxx/thank_you.htm"
%>

Jul 19 '05 #7

"Ray at <%=sLocation%>" <myFirstNameATlane34dotKOMM> wrote in message
news:uv**************@TK2MSFTNGP11.phx.gbl...
Try:
<%
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

sBody = sBody & "IP Address: " & Request.ServerVariables("REMOTE_ADDR")
''rest of your code
Also, instead of CDONTS, you should be using CDO, unless you're on an NT 4
server. CDONTS is being phased out.
http://www.aspfaq.com/show.asp?id=2026

Ray at home

Thanks ray that works a treat, just the help i was after. Thanks for that
:)


Jul 19 '05 #8
>
Also, instead of CDONTS, you should be using CDO, unless you're on an NT 4
server. CDONTS is being phased out.
http://www.aspfaq.com/show.asp?id=2026

Ray at home

Is this likely to be phased out soon?
FYI: The host is www.hostmysite.com

As i said i know nothing about asp / CDONTS / CDO.

currently i am using the above script with a form action of:

<form name="form" method="post" action="http://www.xxx.com/form.asp">

Is there a simple way to alter the current script to CDO or am i going to
have to look for somehting new?

Your advice is appreciated


Jul 19 '05 #9
Win2000 is the last server OS to carry CDONTS natively, and already has CDO
as well.
Win2003 is CDO

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Mike" <me@privacy.net> wrote in message
news:10****************@eunomia.uk.clara.net...

Also, instead of CDONTS, you should be using CDO, unless you're on an NT 4 server. CDONTS is being phased out.
http://www.aspfaq.com/show.asp?id=2026

Ray at home

Is this likely to be phased out soon?
FYI: The host is www.hostmysite.com

As i said i know nothing about asp / CDONTS / CDO.

currently i am using the above script with a form action of:

<form name="form" method="post" action="http://www.xxx.com/form.asp">

Is there a simple way to alter the current script to CDO or am i going to
have to look for somehting new?

Your advice is appreciated

Jul 19 '05 #10
Changing from CDONTS to CDO isn't really hard. You could probably actually
do it with a find/replace in a text editor, for the most part. But
something else to consider is to create a sub or a function to handle
e-mailing and use that in your code, so that if you have to change mail
components, you just change the code in your sub.
Sub SendAnEmail(sFrom, sTo, sSubject, sBody)
Set oMail = CreateObject("YourMailComponent")
'''code to send e-mail

End Sub
Then anywhere in your ASP code where you need to send e-mail, just call the
sub and pass the arguments. You'd want to put this sub in an include file
so you can use it in any page.

Ray at home
"Mike" <me@privacy.net> wrote in message
news:10****************@eunomia.uk.clara.net...

Also, instead of CDONTS, you should be using CDO, unless you're on an NT 4 server. CDONTS is being phased out.
http://www.aspfaq.com/show.asp?id=2026

Ray at home

Is this likely to be phased out soon?
FYI: The host is www.hostmysite.com

As i said i know nothing about asp / CDONTS / CDO.

currently i am using the above script with a form action of:

<form name="form" method="post" action="http://www.xxx.com/form.asp">

Is there a simple way to alter the current script to CDO or am i going to
have to look for somehting new?

Your advice is appreciated

Jul 19 '05 #11

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Changing from CDONTS to CDO isn't really hard. You could probably actually do it with a find/replace in a text editor, for the most part. But
something else to consider is to create a sub or a function to handle
e-mailing and use that in your code, so that if you have to change mail
components, you just change the code in your sub.
Sub SendAnEmail(sFrom, sTo, sSubject, sBody)
Set oMail = CreateObject("YourMailComponent")
'''code to send e-mail

End Sub
Then anywhere in your ASP code where you need to send e-mail, just call the sub and pass the arguments. You'd want to put this sub in an include file
so you can use it in any page.

Ray at home

not sure im with you on the changes.

Does anyone have a basic default cdo asp file script knocking about that
simply sends the form contents
and provides a redirect page.

Im simply looking for an asp which can be called via:

<form name="form" method="post" action="http://www.xxx.com/form.asp">

whch then submits to email. i think it would be wise if i find a CDO one
now rather than later.

cgi/unix scripts are 10 a penny but asp ones seem more difficult to find


Jul 19 '05 #12
Mail with CDO:
http://www.darkfalz.com/1090

Otherwise look at www.aspfaq.com

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Mike" <me@privacy.net> wrote in message
news:10****************@nnrp-t71-03.news.uk.clara.net...

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Changing from CDONTS to CDO isn't really hard. You could probably

actually
do it with a find/replace in a text editor, for the most part. But
something else to consider is to create a sub or a function to handle
e-mailing and use that in your code, so that if you have to change mail
components, you just change the code in your sub.
Sub SendAnEmail(sFrom, sTo, sSubject, sBody)
Set oMail = CreateObject("YourMailComponent")
'''code to send e-mail

End Sub
Then anywhere in your ASP code where you need to send e-mail, just call

the
sub and pass the arguments. You'd want to put this sub in an include file so you can use it in any page.

Ray at home

not sure im with you on the changes.

Does anyone have a basic default cdo asp file script knocking about that
simply sends the form contents
and provides a redirect page.

Im simply looking for an asp which can be called via:

<form name="form" method="post" action="http://www.xxx.com/form.asp">

whch then submits to email. i think it would be wise if i find a CDO one
now rather than later.

cgi/unix scripts are 10 a penny but asp ones seem more difficult to find

Jul 19 '05 #13

"Mike" <me@privacy.net> wrote in message
news:10****************@nnrp-t71-03.news.uk.clara.net...

not sure im with you on the changes.
That's okay. One step at a time.
Does anyone have a basic default cdo asp file script knocking about that
simply sends the form contents
and provides a redirect page.
I posted a decent link in my first reply yesterday. Did you check out the
page? Here's the link again.
http://www.aspfaq.com/show.asp?id=2026
i think it would be wise if i find a CDO one
now rather than later.
I commend you for that attitude. Most people would say the Hell with it and
make things harder for themselves later on. Good job. :]

cgi/unix scripts are 10 a penny but asp ones seem more difficult to find


If you have not already done so, bookmark http://www.darkfalz.com/ and the
the sites found at http://www.darkfalz.com/Links.aspx.

Ray at work
Jul 19 '05 #14

Ok this basic cdo script seems to dot he trick.

<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
Set iMsg = CreateObject("CDO.Message")
iMsg.To = "So*****@SomeSite.com"
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <me@ThisSite.com>"
iMsg.TextBody = "This is the body of the message"
iMsg.Send
%>
The problem is how i go about adding the following elements:

1) Getting the form to submit the contents of all form fields.
Obviously currently all it submits is the text body message: "This is the
body of the message"

2) Specifying a redirect url
Response.Redirect "http://www.xxx.com/thank_you.htm"

3) Adding the ip address of the form sender ie:
sBody = sBody & "IP Address: " & Request.ServerVariables("REMOTE_ADDR")
Any help in correctly adding the above to the script would be appreciated

Jul 19 '05 #15

"Mike" <me@privacy.net> wrote in message
news:10****************@dyke.uk.clara.net...

Ok this basic cdo script seems to dot he trick.

<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
Set iMsg = CreateObject("CDO.Message")
iMsg.To = "So*****@SomeSite.com"
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <me@ThisSite.com>"
iMsg.TextBody = "This is the body of the message"
iMsg.Send
%>
The problem is how i go about adding the following elements:

1) Getting the form to submit the contents of all form fields.
Obviously currently all it submits is the text body message: "This is the
body of the message"
Remember in your original post you had that For Each x in request.form
line...? You can still use that variable in place of the text string that's
currently set as the .textbody.

2) Specifying a redirect url
Response.Redirect "http://www.xxx.com/thank_you.htm"
Use that exact line that you have there. (Or just response.redirect
"/thankyou.htm" if this is all taking place on your site.)

3) Adding the ip address of the form sender ie:
sBody = sBody & "IP Address: " & Request.ServerVariables("REMOTE_ADDR")


As covered in the original reply. I think now it's just a matter of piecing
it all together.

Ray at work
Jul 19 '05 #16

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:us**************@TK2MSFTNGP09.phx.gbl...

"Mike" <me@privacy.net> wrote in message
news:10****************@dyke.uk.clara.net...

Ok this basic cdo script seems to dot he trick.

<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
Set iMsg = CreateObject("CDO.Message")
iMsg.To = "So*****@SomeSite.com"
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <me@ThisSite.com>"
iMsg.TextBody = "This is the body of the message"
iMsg.Send
%>
The problem is how i go about adding the following elements:

1) Getting the form to submit the contents of all form fields.
Obviously currently all it submits is the text body message: "This is the body of the message"
Remember in your original post you had that For Each x in request.form
line...? You can still use that variable in place of the text string

that's currently set as the .textbody.

2) Specifying a redirect url
Response.Redirect "http://www.xxx.com/thank_you.htm"
Use that exact line that you have there. (Or just response.redirect
"/thankyou.htm" if this is all taking place on your site.)

3) Adding the ip address of the form sender ie:
sBody = sBody & "IP Address: " & Request.ServerVariables("REMOTE_ADDR")


As covered in the original reply. I think now it's just a matter of

piecing it all together.

Ray at work

Hi
sry not sure i was clear, i tried to create the right script but because
i'm not familar with asp i can't find the errors.
perhaps easier if i post what i have (see below). can you tell me whats
wrong?
<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
Set iMsg = CreateObject("CDO.Message")
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf

iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me mi**@xxx.com"
iMsg.Body = sBody & vbCrLf
iMsg.sBody = sBody & "IP Address: " &
Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>
Jul 19 '05 #17
You didn't close your For loop.

<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
Set iMsg = CreateObject("CDO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me mi**@xxx.com"
iMsg.Body = sBody & vbCrLf
iMsg.sBody = sBody & "IP Address: " &
Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>

Ray at work
Hi
sry not sure i was clear, i tried to create the right script but because
i'm not familar with asp i can't find the errors.
perhaps easier if i post what i have (see below). can you tell me whats
wrong?
<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
Set iMsg = CreateObject("CDO.Message")
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf

iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me mi**@xxx.com"
iMsg.Body = sBody & vbCrLf
iMsg.sBody = sBody & "IP Address: " &
Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>

Jul 19 '05 #18
I did not look closely enough. There's no .body or .sbody thing. You had
the right property in there before. .TextBody.

Ray at work

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:ut**************@TK2MSFTNGP11.phx.gbl...
You didn't close your For loop.

<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
Set iMsg = CreateObject("CDO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me mi**@xxx.com"
iMsg.Body = sBody & vbCrLf
iMsg.sBody = sBody & "IP Address: " &
Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>

Ray at work
Hi
sry not sure i was clear, i tried to create the right script but because i'm not familar with asp i can't find the errors.
perhaps easier if i post what i have (see below). can you tell me whats
wrong?
<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
Set iMsg = CreateObject("CDO.Message")
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf

iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me mi**@xxx.com"
iMsg.Body = sBody & vbCrLf
iMsg.sBody = sBody & "IP Address: " &
Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>


Jul 19 '05 #19
I must be close! grrr.
Any pointers what is wrong?
<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

Set iMsg = CreateObject("CDO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me mi**@xxx.com"
iMsg.TextBody = "This is the body of the message"
Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>
Jul 19 '05 #20
I really think that if you step back and look at everything, you'll be able
to piece it all together. I don't mean this in a snide way, but is your
intention to learn ASP or just get this script working and not care about
learning anything?

Ray at work

"Mike" <me@privacy.net> wrote in message
news:10***************@nnrp-t71-02.news.uk.clara.net...
I must be close! grrr.
Any pointers what is wrong?
<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

Set iMsg = CreateObject("CDO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me mi**@xxx.com"
iMsg.TextBody = "This is the body of the message"
Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>

Jul 19 '05 #21

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:Ol**************@TK2MSFTNGP12.phx.gbl...
I really think that if you step back and look at everything, you'll be able to piece it all together. I don't mean this in a snide way, but is your
intention to learn ASP or just get this script working and not care about
learning anything?

Ray at work


The best way i learn this basic stuff is by knowing the answer (ie seeing a
working script) so I can see
where its wrong and work backwards.
I appreciate what your saying, youve helped enough.

Can anyone else tell me what is wrong with this basic script?

many thanks

Jul 19 '05 #22

"Mike" <me@privacy.net> wrote in message
news:10****************@nnrp-t71-01.news.uk.clara.net...

The best way i learn this basic stuff is by knowing the answer (ie seeing

a working script) so I can see
where its wrong and work backwards.
Fair enough. :]
Here:

<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg, sBody

'''sBody wasn't dimmed before. It must be dimmed
'''when using Option Explicit. (Using Option Explicit
'''is a GOOD habit. I suggest you continue using it.)

'''x was not dimmed either.
Dim x
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

'''You now have a variable that contains the form data separated by line
breaks.

'''Concatenate IP address:
sBody = sBody & Request.ServerVariables("REMOTE_ADDR")

'''Now your body is ready, create your e-mail object

Set iMsg = CreateObject("CDO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me mi**@xxx.com"

'''For the body text, you want to use the variable from above
iMsg.TextBody = sBody

iMsg.Send

'Response.Redirect "/thank_you.htm"
'Response.REdirect is commented out. It's best not to redirect
'until you know everything's working well.
'
'For the sake of seeing what's going on, let's response.write the value
'of that sBody variable.

Response.Write sBody
'Note that vbCrLf is just a line break. Everything will appear
'on one line in the browser, but that's because a Web page would
'need <br> for line breaks. You don't care if it's displayed all
'in one line in the browser. A view-source will show it to you
'the same way that you will (hopefully) see it in an e-mail.
%>
Ray at work



I appreciate what your saying, youve helped enough.

Can anyone else tell me what is wrong with this basic script?

many thanks

Jul 19 '05 #23
Nope, no joy.
i think im going to have to scrap this particular script and try and find
downloadable working script that i can play around with.
Thanks for all your help Ray. I see what youre saying but can't
understand why it doesn't work then assuming everything is correct.
<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg, sBody
Dim x
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
sBody = sBody & Request.ServerVariables("REMOTE_ADDR")
Set iMsg = CreateObject("CDO.Message")
iMsg.To = "mi**@xxx.com"
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <mi**@xxx.com>"
iMsg.TextBody = sBody
iMsg.Send
Response.Redirect "/thank_you.htm"
%>

Jul 19 '05 #24
What's no joy? Did you get an error? COMMENT OUT THE REDIRECT and maybe
you'll see something. What isn't working? There is nothing wrong with the
code below. Perhaps someone else can chime in to verify this.

Ray at work

"Mike" <me@privacy.net> wrote in message
news:10****************@nnrp-t71-03.news.uk.clara.net...
Nope, no joy.
i think im going to have to scrap this particular script and try and find
downloadable working script that i can play around with.
Thanks for all your help Ray. I see what youre saying but can't
understand why it doesn't work then assuming everything is correct.
<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg, sBody
Dim x
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
sBody = sBody & Request.ServerVariables("REMOTE_ADDR")
Set iMsg = CreateObject("CDO.Message")
iMsg.To = "mi**@xxx.com"
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <mi**@xxx.com>"
iMsg.TextBody = sBody
iMsg.Send
Response.Redirect "/thank_you.htm"
%>

Jul 19 '05 #25

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:%2****************@TK2MSFTNGP11.phx.gbl...
What's no joy? Did you get an error? COMMENT OUT THE REDIRECT and maybe
you'll see something. What isn't working? There is nothing wrong with the code below. Perhaps someone else can chime in to verify this.

Ray at work

Just goes to a HTTP 500 error page. Wonder if it could be the host:
www.hostmysite.com
Jul 19 '05 #26
500 page means you have IE configured to show "friendly" error messages most
likely....

Turn that off and try again

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Mike" <me@privacy.net> wrote in message
news:10****************@nnrp-t71-02.news.uk.clara.net...

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:%2****************@TK2MSFTNGP11.phx.gbl...
What's no joy? Did you get an error? COMMENT OUT THE REDIRECT and maybe you'll see something. What isn't working? There is nothing wrong with

the
code below. Perhaps someone else can chime in to verify this.

Ray at work

Just goes to a HTTP 500 error page. Wonder if it could be the host:
www.hostmysite.com

Jul 19 '05 #27
Okay, we're one inch closer now. The next step is to find out what the real
error is. Read this and change your setting and try again. You will see
the error.

www.aspfaq.com/2109

Ray at work

"Mike" <me@privacy.net> wrote in message
news:10****************@nnrp-t71-02.news.uk.clara.net...

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:%2****************@TK2MSFTNGP11.phx.gbl...
What's no joy? Did you get an error? COMMENT OUT THE REDIRECT and maybe you'll see something. What isn't working? There is nothing wrong with

the
code below. Perhaps someone else can chime in to verify this.

Ray at work

Just goes to a HTTP 500 error page. Wonder if it could be the host:
www.hostmysite.com

Jul 19 '05 #28
Thanks Ray / Curt
Have come across that browser issue before, great to know theres a way to
get the real details back!

Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'x'

/asp/form.asp, line 5

================================

<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

Set iMsg = CreateObject("CDO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <mi**@xxx.com>"
iMsg.TextBody = "This is the body of the message"
Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>

Jul 19 '05 #29
Does this look familiar to you at all? It's from a few posts back:

'''sBody wasn't dimmed before. It must be dimmed
'''when using Option Explicit. (Using Option Explicit
'''is a GOOD habit. I suggest you continue using it.)

'''x was not dimmed either.

--

Ray at home
Microsoft ASP MVP

In news:10****************@demeter.uk.clara.net,
Mike <me@privacy.net> typed:
Thanks Ray / Curt
Have come across that browser issue before, great to know theres a
way to get the real details back!

Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'x'

/asp/form.asp, line 5

================================

<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

Set iMsg = CreateObject("CDO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <mi**@xxx.com>"
iMsg.TextBody = "This is the body of the message"
Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>

Jul 19 '05 #30

"Ray at <%=sLocation%> [MVP]" <myFirstNameATlane34dotKOMM> wrote in message
news:ux**************@TK2MSFTNGP09.phx.gbl...
Does this look familiar to you at all? It's from a few posts back:

'''sBody wasn't dimmed before. It must be dimmed
'''when using Option Explicit. (Using Option Explicit
'''is a GOOD habit. I suggest you continue using it.)

'''x was not dimmed either.

--

Ray at home
Microsoft ASP MVP


yep id already tried Dim didn't work
Jul 19 '05 #31
Mike wrote:
"Ray at <%=sLocation%> [MVP]" <myFirstNameATlane34dotKOMM> wrote in
message news:ux**************@TK2MSFTNGP09.phx.gbl...
Does this look familiar to you at all? It's from a few posts back:

'''sBody wasn't dimmed before. It must be dimmed
'''when using Option Explicit. (Using Option Explicit
'''is a GOOD habit. I suggest you continue using it.)

'''x was not dimmed either.

--

Ray at home
Microsoft ASP MVP


yep id already tried Dim didn't work


Dammit.

Please stop saying that! We don't know what "didn't work" means! We're not
looking over your shoulder!

Sorry, but this is frustrating - you have been asked several times in this
thread to explicitly describe your problem without using the words "did not
work".
Show the revised code, and show the error you you get when you run it!

Are you saying that you still get the

Variable is undefined: 'x'

error when you put the line

Dim x

into your code? That's not right, show us the code that produces the error.

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #32

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message news:%23x%

Ouch.
I'm trying lots of variations therefore it would be impossible to
keep posting everything i try.

Example:

Microsoft VBScript compilation error '800a03f2'

Expected identifier

/asp/medical1.asp, line 5

Dim For Each x in request.form
----^

====================================

<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
Dim For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

Set iMsg = CreateObject("CDO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me mi**@xxx.com"
iMsg.TextBody = "This is the body of the message"
Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>


Jul 19 '05 #33
Mike wrote:
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message news:%23x%
Ouch.
I'm trying lots of variations therefore it would be impossible to
keep posting everything i try.
We can't help you unless you do. Again, we are not looking over your
shoulder.

Look,. we don't expect you to post everything you try. But, we do expect you
to post the information needed to help you with the particular problem you
are posting about. This means: describing your problem without using the
words "did not work", or "it fails", or any variation on this theme. :-)

Example:

Microsoft VBScript compilation error '800a03f2'

Expected identifier

/asp/medical1.asp, line 5

Dim For Each x in request.form
----^

See? Now that I see the error and the code, I see the serious mistake you
made :-)

"Dim" is used to declare variables, not to put at the beginning of
statements in which the variables are used. This modification will get rid
of that particular error:
<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
Dim x
For Each x in request.form
This will also work:
<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg, x
For Each x in request.form

HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #34
Thanks for that, i'm with you.
What about the sBody variable?
Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'sBody'

/asp/test.asp, line 7

<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
Dim x
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

Set iMsg = CreateObject("CDO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <mi**@xxx.com>"
iMsg.TextBody = "This is the body of the message"
Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>

Jul 19 '05 #35
Mike wrote:
Thanks for that, i'm with you.
What about the sBody variable?
Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'sBody'

/asp/test.asp, line 7

Same solution: add a line to declare (define) the variable:

dim sBody

HTH,
Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #36

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:ey**************@TK2MSFTNGP12.phx.gbl...
I'd already tried that but the form just submits the text "This is the body
of the message"
rather than the form field data.
Basically im back exactly where i started yesterday but with a little more
knowledge about Dim

Does anyone out there have a 'working script' which submits the contents of
a form???
<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
Dim x
For Each x in request.form
Dim sBody
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

Set iMsg = CreateObject("CDO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <mi**@xxx.com>"
iMsg.TextBody = "This is the body of the message"
Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>

Jul 19 '05 #37
you need this -
iMsg.TextBody = sBody

instead of this -
iMsg.TextBody = "This is the body of the message"
"Mike" <me@privacy.net> wrote in message
news:10****************@iris.uk.clara.net...

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:ey**************@TK2MSFTNGP12.phx.gbl...
I'd already tried that but the form just submits the text "This is the body of the message"
rather than the form field data.
Basically im back exactly where i started yesterday but with a little more
knowledge about Dim

Does anyone out there have a 'working script' which submits the contents of a form???
<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
Dim x
For Each x in request.form
Dim sBody
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

Set iMsg = CreateObject("CDO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <mi**@xxx.com>"
iMsg.TextBody = "This is the body of the message"
Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>

Jul 19 '05 #38
I'm sorry.

Will you go back and READ THIS THREAD AGAIN?! Will you please TRY to
comprehend what other people wrote? I explained why you get "This is the
body of the message" in the e-mail before. Did you read it? Have you read
any of these replies, or are you just skipping right to the code hoping it
works. And when it doesn't work, you take ZERO seconds to try to learn why?
I'm sorry, but if you had been reading the posts with the desire to learn
and figure out what's going on, you have would had this working two days
ago. Every piece of information you could possibly need exists in this
thread. So go back and just keep reading until YOU figure it out. This
will help you learn ASP instead of learning how to copy and paste.

--

Ray at home
Microsoft ASP MVP

In news:10****************@iris.uk.clara.net,
Mike <me@privacy.net> typed:
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:ey**************@TK2MSFTNGP12.phx.gbl...
I'd already tried that but the form just submits the text "This is
the body of the message"
rather than the form field data.
Basically im back exactly where i started yesterday but with a little
more knowledge about Dim

Does anyone out there have a 'working script' which submits the
contents of a form???
<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
Dim x
For Each x in request.form
Dim sBody
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

Set iMsg = CreateObject("CDO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <mi**@xxx.com>"
iMsg.TextBody = "This is the body of the message"
Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>

Jul 19 '05 #39
Try this:

<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
Dim x
Dim sBody

For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

Set iMsg = CreateObject("CDO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <mi**@xxx.com>"
iMsg.TextBody = sBody & Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>
Regards,
Peter Foti


"Mike" <me@privacy.net> wrote in message
news:10****************@iris.uk.clara.net...

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:ey**************@TK2MSFTNGP12.phx.gbl...
I'd already tried that but the form just submits the text "This is the body of the message"
rather than the form field data.
Basically im back exactly where i started yesterday but with a little more
knowledge about Dim

Does anyone out there have a 'working script' which submits the contents of a form???
<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
Dim x
For Each x in request.form
Dim sBody
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

Set iMsg = CreateObject("CDO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <mi**@xxx.com>"
iMsg.TextBody = "This is the body of the message"
Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>

Jul 19 '05 #40

"Ray at <%=sLocation%> [MVP]" <myFirstNameATlane34dotKOMM> wrote in message
news:OI**************@TK2MSFTNGP12.phx.gbl...
I'm sorry.

Will you go back and READ THIS THREAD AGAIN?! Will you please TRY to
comprehend what other people wrote? I explained why you get "This is the
body of the message" in the e-mail before. Did you read it? Have you read any of these replies, or are you just skipping right to the code hoping it
works. And when it doesn't work, you take ZERO seconds to try to learn why? I'm sorry, but if you had been reading the posts with the desire to learn
and figure out what's going on, you have would had this working two days
ago. Every piece of information you could possibly need exists in this
thread. So go back and just keep reading until YOU figure it out. This
will help you learn ASP instead of learning how to copy and paste.

--

Ray at home
Microsoft ASP MVP


I was replying to Bob, Piss off you arse hole.
Jul 19 '05 #41

"Peter Foti" <pe***@Idontwantnostinkingemailfromyou.com> wrote in message
news:10*************@corp.supernews.com...
Try this:

<%@ Language=VBScript %>
<%
Option Explicit
Dim iMsg
Dim x
Dim sBody

For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

Set iMsg = CreateObject("CDO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <mi**@xxx.com>"
iMsg.TextBody = sBody & Request.ServerVariables("REMOTE_ADDR")

iMsg.Send
Response.Redirect "/thank_you.htm"
%>
Regards,
Peter Foti


Thanks Peter, You're a good guy.
Jul 19 '05 #42

"Alex Goodey" <ag*****@hsfinancial.co.uk> wrote in message
news:bv************@ID-221525.news.uni-berlin.de...
you need this -
iMsg.TextBody = sBody

instead of this -
iMsg.TextBody = "This is the body of the message"

Thanks for that Alex, much appreciated
Jul 19 '05 #43
Nice. :]

--

Ray at home
Microsoft ASP MVP
"Mike" <me@privacy.net> wrote in message
news:10****************@doris.uk.clara.net...

I was replying to Bob, Piss off you arse hole.

Jul 19 '05 #44

Alex Goodey wrote:
* you need this - iMsg.TextBody = sBody instead of this -
iMsg.TextBody = *


It doesn't work for me ... hmmmz
--
XsenseX

Your love, romance & relationship resource
http://www.lovehatch.com
------------------------------------------------------------------------
XsenseX's Profile: http://www.soft-forum.com/forums/mem...nfo&userid=907
View this thread: http://www.soft-forum.com/forums/sho...readid=1204034

Jul 19 '05 #45

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Roel | last post: by
17 posts views Thread by freemann | last post: by
23 posts views Thread by casper christensen | last post: by
12 posts views Thread by liamo | last post: by
2 posts views Thread by Comcast | last post: by
4 posts views Thread by Twisted01 | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.