473,770 Members | 2,630 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_AD DR>
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.CreateOb ject("CDONTS.Ne wMail")
MailObject.From = "we*****@xxx.co m"
MailObject.To = "we*****@xxx.co m"
MailObject.Subj ect = "Form"
MailObject.Body = sBody & vbCrLf

MailObject.Send
Set MailObject = Nothing
' Now redirect
Response.Redire ct "http://www.xxx/thank_you.htm"
%>
Jul 19 '05
44 3263
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.clar a.net...
I must be close! grrr.
Any pointers what is wrong?
<%@ Language=VBScri pt %>
<%
Option Explicit
Dim iMsg
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

Set iMsg = CreateObject("C DO.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.ServerV ariables("REMOT E_ADDR")

iMsg.Send
Response.Redire ct "/thank_you.htm"
%>

Jul 19 '05 #21

"Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
news:Ol******** ******@TK2MSFTN GP12.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.clar a.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=VBScri pt %>
<%
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.ServerV ariables("REMOT E_ADDR")

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

Set iMsg = CreateObject("C DO.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.Redir ect "/thank_you.htm"
'Response.REdir ect 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=VBScri pt %>
<%
Option Explicit
Dim iMsg, sBody
Dim x
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
sBody = sBody & Request.ServerV ariables("REMOT E_ADDR")
Set iMsg = CreateObject("C DO.Message")
iMsg.To = "mi**@xxx.c om"
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <mi**@xxx.com >"
iMsg.TextBody = sBody
iMsg.Send
Response.Redire ct "/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.clar a.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=VBScri pt %>
<%
Option Explicit
Dim iMsg, sBody
Dim x
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
sBody = sBody & Request.ServerV ariables("REMOT E_ADDR")
Set iMsg = CreateObject("C DO.Message")
iMsg.To = "mi**@xxx.c om"
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <mi**@xxx.com >"
iMsg.TextBody = sBody
iMsg.Send
Response.Redire ct "/thank_you.htm"
%>

Jul 19 '05 #25

"Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
message news:%2******** ********@TK2MSF TNGP11.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.clar a.net...

"Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
message news:%2******** ********@TK2MSF TNGP11.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.clar a.net...

"Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
message news:%2******** ********@TK2MSF TNGP11.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=VBScri pt %>
<%
Option Explicit
Dim iMsg
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

Set iMsg = CreateObject("C DO.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.ServerV ariables("REMOT E_ADDR")

iMsg.Send
Response.Redire ct "/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******** ********@demete r.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=VBScri pt %>
<%
Option Explicit
Dim iMsg
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

Set iMsg = CreateObject("C DO.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.ServerV ariables("REMOT E_ADDR")

iMsg.Send
Response.Redire ct "/thank_you.htm"
%>

Jul 19 '05 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3271
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 scripts working on a new server with the most recent version of PHP. I've pretty much taken care of all the various errors that were popping up. Most only pointed out out non-fatal undefined or assumed variables. I've been able to cure most of...
2
5224
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 running IIS on my home machine. My problem is that I need to upload this stuff to a webhosting place and register a domain and I'm not sure what to put as the smtp mail server value
1
1663
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" value="CAM2" name="B1"> So when I click on CAM2 button it will reload http://website/CAM2picture.jpg and when I click on CAM3 button it will reload http://website/CAM3picture.jpg and so on. I appreciate if someone can show me how to do it. Here's a...
17
2087
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 created and working. The first form the user fills out and submits. The form properties are set to Send to other: "Custom ISAPI, NSAPI, CGI, OR ASP SCRIPTING. The method is "POST" and the action is "secondpage.asp". I had to go this route because...
23
2803
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 place a link on there site so people can vote for their program, "ad a click". eg someone clicks the link on some page and it counts +1 click on my page. if some one clicks the link below it will count a click on my page.
12
2241
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 job order form with a little more function than having solely contact details and a big enquiry text area. The form I created in HTML is located at http://www.ebesign.co.nz/projects/justfixit/job_order_form.html and has used javascript to...
3
1810
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 User Box fjdjskfjds in password box www.thescripts.com in website box then i want to have a button which says "save" which then saves the 3 above pieces of text into a notepad file. So like I said I want to be able to type a login, password and...
2
1542
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: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/content/website/html/contact/scformproc.php:1) in /home/content/website/html/contact/scformproc.php on line 51 ? Warning: Cannot modify header information -...
4
1565
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 website rather than searching the entire website to find what they are looking for. I know about my HTML/XHTML and CSS coding and the basic coding for a Search Form. What I need is help with any other files needed to make my Form a workable Search Form so...
70
5403
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 different issue than what I was initially having. I am working on storing data collected from a form on my website. I would like the information to be stored into MySQL once entered by users. I have googled this question and have tried multiple...
0
9602
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9439
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10237
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7431
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2832
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.