Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, I can't seem to find the err

Status
Not open for further replies.

230173

MIS
Jun 22, 2001
208
SG
Hi,

I can't seem to find the error in this line of code.
I always get an 'expected 'end'" error.

<%
naam = Trim(request.form(&quot;name&quot;))
email = Trim(request.form(&quot;email&quot;))
comment = Trim(request.form(&quot;comment&quot;))
IF INSTR( email, &quot;@&quot; ) = 0 OR INSTR( email, &quot;.&quot; ) = 0 THEN
invalidEmail = TRUE
end if
If naam = &quot;&quot; OR content= &quot;&quot; Then
error = TRUE %>
<!DOCTYPE HTML PUBLIC &quot;-//W3Cco
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>
<body>
<%
If error <> true AND invalidemail <> true then
set objMail = server.Createobject(&quot;CDONTS.NewMail&quot;)

ObjMail.From = email
ObjMail.To = &quot;my_email&quot;
Objmail.Subject = &quot;blabla&quot;
'objMail.BCC = &quot;ENTER BCC ADDRESS HERE IF REQUIRED&quot;
objMail.body = &quot;Feedback form. Details below&quot; & vbnewLine & vbNewLine &_
&quot;--------------------------------------------------------&quot; & vbnewLine & vbNewLine &_
&quot;Name: &quot; & naam & vbnewLine & vbNewLine &_
&quot;email: &quot; & email & vbnewLine & vbNewLine &_
&quot;Comments: &quot; & comment & vbnewLine & vbNewLine
objMail.send
Set objmail = Nothing
response.Write(&quot;Thankyou for your comments.&quot;)
ELSE
response.Write(&quot;You have not entered sufficient information please go back and try again&quot;)
End if
%>
</body>
</html>
 
<%
naam = Trim(request.form(&quot;name&quot;))
email = Trim(request.form(&quot;email&quot;))
comment = Trim(request.form(&quot;comment&quot;))
IF INSTR( email, &quot;@&quot; ) = 0 OR INSTR( email, &quot;.&quot; ) = 0 THEN
invalidEmail = TRUE
end if
If naam = &quot;&quot; OR content= &quot;&quot; Then
error = TRUE
END IF

%>
<!DOCTYPE HTML PUBLIC &quot;-//W3Cco
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>
<body>
<%

If error <> true AND invalidemail <> true then
set objMail = server.Createobject(&quot;CDONTS.NewMail&quot;)

ObjMail.From = email
ObjMail.To = &quot;my_email&quot;
Objmail.Subject = &quot;blabla&quot;
'objMail.BCC = &quot;ENTER BCC ADDRESS HERE IF REQUIRED&quot;
objMail.body = &quot;Feedback form. Details below&quot; & vbnewLine & vbNewLine &_
&quot;--------------------------------------------------------&quot; & vbnewLine & vbNewLine &_
&quot;Name: &quot; & naam & vbnewLine & vbNewLine &_
&quot;email: &quot; & email & vbnewLine & vbNewLine &_
&quot;Comments: &quot; & comment & vbnewLine & vbNewLine
objMail.send
Set objmail = Nothing
response.Write(&quot;Thankyou for your comments.&quot;)
ELSE
response.Write(&quot;You have not entered sufficient information please go back and try again&quot;)
End if
%>
</body>
</html> -- Just trying to help...
[wolf]<--- This is a wolf? We need a new icon.......
mikewolf@tst-us.com
 
You should set the browsers settings on that computer to &quot;prompt&quot; for session cookies that way you can tell when the comp is trying to set the cookie. When you go to your first asp page in the site, asp tries to set a session cookie, you should get a prompt. At least this way, we can see that the pc is trying to set the cookie...

Note: you should close your browser and reopen it after you change the security setting to make sure that it takes effect.... -- Just trying to help...
[wolf]<--- This is a wolf? We need a new icon.......
mikewolf@tst-us.com
 
Hi,

Mwolf00, i've copied your code and now i don't get the error mesage but no matter what i do i always get the &quot;
You have not entered sufficient information please go back and try again&quot; mesage.
 
Check your variable names:
Code:
naam = Trim(request.form(&quot;name&quot;))
email = Trim(request.form(&quot;email&quot;))
comment = Trim(request.form(&quot;comment&quot;))
IF INSTR( email, &quot;@&quot; ) = 0 OR INSTR( email, &quot;.&quot; ) = 0 THEN
    invalidEmail = TRUE
    end if 
If naam = &quot;&quot; OR content= &quot;&quot; Then 
...

If you use Option Explicit at the top of your pages you will be required to Dim all your variables, but it will also catch miss-spellings later in your code (comment/content?)

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...) :p
 
Thanks Tarwn,

I adjusted the syntax error ( comment/content) but now i'm getting an error on the following line:
set objMail = server.Createobject(&quot;CDONTS.NewMail&quot;)
But only if enter valid data.

Why?
 
So basically any time you try to instantiate this object (enter data and force it into the if stmt) your get an error.

It's possible you don't have this object on you computer, if your using windows XP the CDONTS object is not on your system.

What's the error your receiving?

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...) :p
 
Well it works on my site.
It doesn't work locally tough. I have XP.
Is there a fix or something?
 
As I said above, the CDONTS object was not included in the Windows XP operating system. I believe they included another mail system object, but have not seen much about it. From what I remember the CDONTS object was only included on the Win2000 systems for backwards compatibility. You may need to buy or download another set of object to setup mail on your system (such as JMail or ASPMail). Again, I am not aware of a fix, but you may get some hits if you google search for CDONTS on XP with ASP.

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...) :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top