Forum Moderators: open

Message Too Old, No Replies

ASP Form

- what am i doing wrong?

         

rj87uk

7:20 pm on Sep 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey there Ive been workin on an ASP form that will email me when someone fills it in then redirects the page :) I cant figure out where im going wrong so any help? :-D

<% if request.form("post") = 1 then
title = Request.form("title")
firstname = Request.form("firstname")
surname = Request.form("surname")
house_name = Request.form("house_name")
street = Request.form("street")
state_province = Request.form("state_province")
country = Request.form("country")
postcode_zip = Request.form("postcode_zip")
dayphone = Request.form("dayphone")
evening_phone = Request.form("evening_phone")
what_tour = Request.form("what")
email = Request.form("email")
set mail = Server.CreateObject("CDO.Message")
mail.to = "raymond@directglasgow.co.uk"
mail.from= email
mail.subject = "Enquiry"
mail.textbody = title + vbcrlf + firstname + vbcrlf + surname + vbcrlf + house_name + vbcrlf + street + vbcrlf + state_province + vbcrlf + country + vbcrlf + postcode_zip + vbcrlf + dayphone + vbcrlf + evening_phone + vbcrlf + what + vbcrlf + email
mail.send
set mail = nothing
response.Redirect "www.google.com"
%>

when i try tis i get an ASP error

Microsoft VBScript compilation error '800a03f6'

Expected 'End'

/cgi-bin/enquiry.asp, line 21

line 21 is - response.Redirect "www.google.com"
But i have tried a few things...

well im happy i got this far :)

Any help will very good!

duckhunter

7:33 pm on Sep 3, 2004 (gmt 0)

10+ Year Member



Missing an End If for your If

<% if request.form("post") = 1 then
title = Request.form("title")
firstname = Request.form("firstname")
surname = Request.form("surname")
house_name = Request.form("house_name")
street = Request.form("street")
state_province = Request.form("state_province")
country = Request.form("country")
postcode_zip = Request.form("postcode_zip")
dayphone = Request.form("dayphone")
evening_phone = Request.form("evening_phone")
what_tour = Request.form("what")
email = Request.form("email")
set mail = Server.CreateObject("CDO.Message")
mail.to = "raymond@directglasgow.co.uk"
mail.from= email
mail.subject = "Enquiry"
mail.textbody = title + vbcrlf + firstname + vbcrlf + surname + vbcrlf + house_name + vbcrlf + street + vbcrlf + state_province + vbcrlf + country + vbcrlf + postcode_zip + vbcrlf + dayphone + vbcrlf + evening_phone + vbcrlf + what + vbcrlf + email
mail.send
set mail = nothing
response.Redirect "www.google.com"
End If
%>

rj87uk

7:54 pm on Sep 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you very much you got past that!

But what i dont understand is why it takes me to a blank page now...
Source of page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>

hmmm... ps. no email got sent :-(

pps. it goes to the page with the ASP code, and shows a blank page... lol!

duckhunter

8:37 pm on Sep 3, 2004 (gmt 0)

10+ Year Member



Are you sure your "IF" is evaluating properly? Add and Else to see what happens.

<% if request.form("post") = 1 then
......
mail.send
set mail = nothing
response.Redirect "www.google.com"
Else
Response.write "Did not send email"
End If
%>

rj87uk

8:48 pm on Sep 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I put in the Else statement;

And when i done the form i got 'Did not send email'

If you have Instant messanger, im on that sticky me, (only if you can be bothered!)

You see im only learning the basics of asp...

munchiez

3:35 pm on Sep 22, 2004 (gmt 0)

10+ Year Member



Try changing

response.Redirect "www.google.com"

to

response.redirect "http://www.google.com/"

If you don't put the http:// before the url, it'll try to redirect to a file/directory named www.google.com on your own server, i.e. www.yourserver.com/www.google.com

duckhunter

11:40 pm on Sep 22, 2004 (gmt 0)

10+ Year Member



It's hitting the Else Statement.

Pretty obvious that request.form("post") IS NOT = 1

There lies your problem. What is the value of request.form("post")?