473,785 Members | 2,568 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 3265

"Ray at <%=sLocation% > [MVP]" <myFirstNameATl ane34dotKOMM> wrote in message
news:ux******** ******@TK2MSFTN GP09.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]" <myFirstNameATl ane34dotKOMM> wrote in
message news:ux******** ******@TK2MSFTN GP09.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******@NOyah oo.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=VBScri pt %>
<%
Option Explicit
Dim iMsg
Dim 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 #33
Mike wrote:
"Bob Barrows" <re******@NOyah oo.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=VBScri pt %>
<%
Option Explicit
Dim iMsg
Dim x
For Each x in request.form
This will also work:
<%@ Language=VBScri pt %>
<%
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=VBScri pt %>
<%
Option Explicit
Dim iMsg
Dim x
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 #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******@NOyah oo.SPAMcom> wrote in message
news:ey******** ******@TK2MSFTN GP12.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=VBScri pt %>
<%
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("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 #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.u k.clara.net...

"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:ey******** ******@TK2MSFTN GP12.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=VBScri pt %>
<%
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("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 #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.u k.clara.net,
Mike <me@privacy.net > typed:
"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:ey******** ******@TK2MSFTN GP12.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=VBScri pt %>
<%
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("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 #39
Try this:

<%@ Language=VBScri pt %>
<%
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("C DO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <mi**@xxx.com >"
iMsg.TextBody = sBody & Request.ServerV ariables("REMOT E_ADDR")

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


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

"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:ey******** ******@TK2MSFTN GP12.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=VBScri pt %>
<%
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("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 #40

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
2806
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
2242
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
5406
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
9645
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
10341
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
10155
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8979
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7502
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
5383
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...
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
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.