473,387 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 3189
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old...
2
by: Mindful_Spirit | last post by:
I'm trying to set up a basic email feed back form like this, and was wondering about some basic configuration settings. I have used code from this website. I have it working just fine. I'm...
1
by: Roel | last post by:
Hello, I have a simple script that will reload http://website/CAM1picture.jpg every xx minutes. I'm trying to add a form <input type="submit" value="CAM1" name="B1"><input type="submit"...
17
by: freemann | last post by:
Can anyone provide example code showing how to send form results to a results page, email and a comma delimited file? Notice that I need it going to all three locations. Details: I have forms...
23
by: casper christensen | last post by:
Hi I run a directory, where programs are listed based on the number of clicks they have recieved. The program with most clicks are placed on top and so on. Now I would like people to be apple to...
12
by: liamo | last post by:
Don't laugh lol I know your all php guru's : ) Ok, so I have little if any knowledge with the programming language php - only having created small enquiry forms. Now I have a client that needs a...
3
by: Porkie999 | last post by:
-----------------------------------------------------------------------QUESTION hi i am really stuck with this and its only a small problem. i want to be able to type ......... dsfsjfjsjjfs in...
2
by: Comcast | last post by:
I am using a form that uses PHP to create an e-mail and send it off. When the script runs, I get an error page, although the e-mail is sent off. The error I am getting is: Warning:...
4
by: Twisted01 | last post by:
Hello, I am new here and I hope I have the correct forum to answer my question. I am creating a website for a friend and they need a "Search Form" so that visitors can search for items on the...
70
mideastgirl
by: mideastgirl | last post by:
I have recently been working on a website for an honors association, and have a lot of difficulty but have found help from those on this site. I would like to see if I can get some more help on a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.