Print Page | Close Window

Form Error (Variables)

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=5069
Printed Date: 29 March 2026 at 3:40pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Form Error (Variables)
Posted By: Angel of Death
Subject: Form Error (Variables)
Date Posted: 16 August 2003 at 10:55am

Right, I'm setting up a contact form here: http://www.blastwave.org.uk/info - www.blastwave.org.uk/info

I have my default page with all the standard (and simple) Form Code on, then I have my second page, aci.asp (assort contact information) which is (as most reading this would know) basically where the info is processed and the email is sent off to me, here is my problem though:

 <%
'receive the values sent from the form and assign them to variables...
'declare the variables that will receive the values
'note that request.form("name") will receive the value entered into the textfield
'called name, and so with email and message
Dim name,email,title,inquiry,NewMailObj,department,message

department=Request.Form("department")
name=request.form("name")
email=request.form("email")
title=request.form("title")
inquiry=request.form("inquiry")

'create the mail object and send the details
Set NewMailObj=Server.CreateObject("CDONTS.NewMail")
NewMailObj.From = "& email & _
NewMailObj.To = " mailto:webmaster@blastwave.org.uk - webmaster@blastwave.org.uk "
NewMailObj.Subject = "New message sent.."
NewMailObj.Body = "the name you entered was " & name & _
"<br>the email was " & email & _
"<br>the message was " & message

'you need to add the following lines FOR the mail to be sent in HTML format
NewMailObj.BodyFormat = 0
NewMailObj.MailFormat = 0
NewMailObj.Send
Set NewMailObj = nothing
%>

This is the entire ASP in aci.asp, not to mention of course, the standard:

<% @ Language="VBscript" %>
<% Option Explicit %>

At the top of the page.

- But -

You see the bold/red text; that's what's stumped me. As I have been designing for over a year but I've never made a form like this; my forms have had the action="mailto:..." function and I had special software which decoded the stuff that was sent to my email from jumbled code to straight up "Name: Bob Email: bob@hotmail" etc. etc.

I'm sidetracking here..

Anyhoo, what is the exact code that goes in there? I tried making it the variable for email, as you can see, tried putting quotes around it etc. but realised - foolishly so - that you can't even out quotes as there is one at the front of the "&email&_ by default.

So yeah, what does one do?

(Before you ask: I am very much a newcomer to ASP, been working with HTML/CSS all the while, but I need to up the standards a bit and ASP seems the way to go. I'm getting there ..so slowly..)



-------------
http://www.blastwave.org.uk">



Replies:
Posted By: b_bonnett
Date Posted: 16 August 2003 at 5:16pm

Using NewMailObj.From = email should work; thats how I do it in my forms.

Blair



-------------
Webmaster, http://www.planegallery.net/ - The Plane Gallery
Greetings From Christchurch


Posted By: Angel of Death
Date Posted: 16 August 2003 at 7:16pm

Success.. (common sense eludes me more often than I'd like..)

BUT... doing this revealed more problems, I realised I'd missed out "department" or "inquiry" in the email section:

'create the mail object and send the details
Set NewMailObj=Server.CreateObject("CDONTS.NewMail")
NewMailObj.From = "& email & _
NewMailObj.To = " mailto:webmaster@blastwave.org.uk - webmaster@blastwave.org.uk "
NewMailObj.Subject = "New message sent.."
NewMailObj.Body = "the name you entered was " & name & _
"<br>the email was " & email & _
"<br>the message was " & message
"<br>the inquiry was " & inquiry % _
"<br>the department was " & department % _

I added them like so... and got this:

Microsoft VBScript compilation error '800a0400'

Expected statement

/info/aci.asp, line 50

"<br>the inquiry was " & inquiry % _
^
...So yeah, I'm still confused.


-------------
http://www.blastwave.org.uk">


Posted By: 3BEPb
Date Posted: 16 August 2003 at 9:30pm
Angel, what da hell is % _ for?


Posted By: b_bonnett
Date Posted: 16 August 2003 at 11:56pm

I suggest you get a book on ASP - the "Dummies Guide to ..." is a good series to use for learning.

Basically it needs to be as follows:

NewMailObj.Body = "the name you entered was " & name & _
"<br>the email was " & email & _
"<br>the message was " & message & _
"<br>the inquiry was " & inquiry & _
"<br>the department was " & department

Blair



-------------
Webmaster, http://www.planegallery.net/ - The Plane Gallery
Greetings From Christchurch


Posted By: Angel of Death
Date Posted: 17 August 2003 at 9:46am

Thanks, Blair. Very helpful. (i'd use the thumbs up smilie here but he makes that stupid face)

If I buy one of those books I am doing it online, I refuse to look a cashier in the eye with a "...for dummies" book in my hand!



-------------
http://www.blastwave.org.uk">


Posted By: pmormr
Date Posted: 17 August 2003 at 3:57pm

The i would suggest reading a "The Idiots guide to..."



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: b_bonnett
Date Posted: 17 August 2003 at 5:22pm

Or you could wear a mask .

I take it, since you edited that bit out, that you figured out how to send it? If you didn't, just add the following line at the bottom of the code:
NewMailObj.Send

Blair



-------------
Webmaster, http://www.planegallery.net/ - The Plane Gallery
Greetings From Christchurch


Posted By: Angel of Death
Date Posted: 18 August 2003 at 12:50pm
Yeah I had all the rest of the code sorted, I just didn't know how to define email, and then after that I accidentally added an extra & _ on the end, it's all sorted now; thanks.

-------------
http://www.blastwave.org.uk">



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net