Web Wiz - Solar Powered Eco Web Hosting

  New Posts New Posts RSS Feed - Form Error (Variables)
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Form Error (Variables)

 Post Reply Post Reply Page  12>
Author
Angel of Death View Drop Down
Newbie
Newbie


Joined: 11 January 2003
Location: United Kingdom
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote Angel of Death Quote  Post ReplyReply Direct Link To This Post Topic: Form Error (Variables)
    Posted: 16 August 2003 at 10:55am

Right, I'm setting up a contact form here: 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 = "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..)

Back to Top
b_bonnett View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Location: New Zealand
Status: Offline
Points: 275
Post Options Post Options   Thanks (0) Thanks(0)   Quote b_bonnett Quote  Post ReplyReply Direct Link To This Post Posted: 16 August 2003 at 5:16pm

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

Blair

Webmaster, The Plane Gallery
Greetings From Christchurch
Back to Top
Angel of Death View Drop Down
Newbie
Newbie


Joined: 11 January 2003
Location: United Kingdom
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote Angel of Death Quote  Post ReplyReply Direct Link To This Post 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 = "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.
Back to Top
3BEPb View Drop Down
Groupie
Groupie


Joined: 07 August 2003
Location: United States
Status: Offline
Points: 81
Post Options Post Options   Thanks (0) Thanks(0)   Quote 3BEPb Quote  Post ReplyReply Direct Link To This Post Posted: 16 August 2003 at 9:30pm
Angel, what da hell is % _ for?
Back to Top
b_bonnett View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Location: New Zealand
Status: Offline
Points: 275
Post Options Post Options   Thanks (0) Thanks(0)   Quote b_bonnett Quote  Post ReplyReply Direct Link To This Post 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, The Plane Gallery
Greetings From Christchurch
Back to Top
Angel of Death View Drop Down
Newbie
Newbie


Joined: 11 January 2003
Location: United Kingdom
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote Angel of Death Quote  Post ReplyReply Direct Link To This Post 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!



Edited by Angel of Death
Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 17 August 2003 at 3:57pm

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

Back to Top
b_bonnett View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Location: New Zealand
Status: Offline
Points: 275
Post Options Post Options   Thanks (0) Thanks(0)   Quote b_bonnett Quote  Post ReplyReply Direct Link To This Post 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, The Plane Gallery
Greetings From Christchurch
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.07
Copyright ©2001-2024 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2024 Web Wiz Ltd. All rights reserved.