Mark Wood
asked on
ASP Form Help needed
I have an asp contact form with a selection box. The selection box has options to select who to send the email to.
<option value="email@xxx.com">The Pastor</option>
<option value="email@xxx.com">Food Pantry</option>
and so on. When you hit submit it goes to info-submit.asp where I have this code.
<%
If request.form("B1") = "Submit" Then
strSpmChk = request.form("SpmChk")
if strSpmChk <>"" then
'Session.Abandon
response.redirect "index.asp"
end if
Dim objJMail1
Set objJMail1 = Server.CreateObject("JMail .SMTPMail" )
objJMail1.ServerAddress = "xxx.xxx.xxx.xxx:25"
objJMail1.Sender = request.form("Contact")
objJMail1.SenderName = "EFBC Online Contact Form"
objJMail1.AddRecipient request.form("Contact")
' objJMail1.AddRecipient "eltonshop@bellsouth.net"
objJMail1.Subject = "EFBC Contact Form"
objJMail1.ContentType = "text/html"
JMail1Body=JMail1body & "<h1>The following was submitted via the Contact Form On The Website</h1><br><br>"
JMail1Body=JMail1body & "<h1>CONTACT INFORMATION</h1><br>"
JMail1Body=JMail1body & "Name------------------->& nbsp;" & request.form("Name") & "<br>"
JMail1Body=JMail1body & "Email Address----------> " & request.form("Email") & "<br>"
JMail1Body=JMail1body & "Phone Number-----------> " & request.form("Phone") & "<br>"
JMail1Body=JMail1body & "Message---------------->& nbsp;" & request.form("Message") & "<br>"
JMail1Body=JMail1Body & "<img border='0' src='http://www.efbconline.com/images/header/logo.gif' width='682' height='149'>"
objJMail1.HTMLBody = JMail1Body
objJMail1.Priority = 3
objJMail1.Execute
Set objJMail1 = Nothing
End If
%>
<% response.redirect "contact.asp"%>
The problem is that it isn't getting the email address from the form and sending the emails.
Any ideas?
<option value="email@xxx.com">The Pastor</option>
<option value="email@xxx.com">Food
and so on. When you hit submit it goes to info-submit.asp where I have this code.
<%
If request.form("B1") = "Submit" Then
strSpmChk = request.form("SpmChk")
if strSpmChk <>"" then
'Session.Abandon
response.redirect "index.asp"
end if
Dim objJMail1
Set objJMail1 = Server.CreateObject("JMail
objJMail1.ServerAddress = "xxx.xxx.xxx.xxx:25"
objJMail1.Sender = request.form("Contact")
objJMail1.SenderName = "EFBC Online Contact Form"
objJMail1.AddRecipient request.form("Contact")
' objJMail1.AddRecipient "eltonshop@bellsouth.net"
objJMail1.Subject = "EFBC Contact Form"
objJMail1.ContentType = "text/html"
JMail1Body=JMail1body & "<h1>The following was submitted via the Contact Form On The Website</h1><br><br>"
JMail1Body=JMail1body & "<h1>CONTACT INFORMATION</h1><br>"
JMail1Body=JMail1body & "Name------------------->&
JMail1Body=JMail1body & "Email Address----------> " & request.form("Email") & "<br>"
JMail1Body=JMail1body & "Phone Number-----------> " & request.form("Phone") & "<br>"
JMail1Body=JMail1body & "Message---------------->&
JMail1Body=JMail1Body & "<img border='0' src='http://www.efbconline.com/images/header/logo.gif' width='682' height='149'>"
objJMail1.HTMLBody = JMail1Body
objJMail1.Priority = 3
objJMail1.Execute
Set objJMail1 = Nothing
End If
%>
<% response.redirect "contact.asp"%>
The problem is that it isn't getting the email address from the form and sending the emails.
Any ideas?
What's the HTML markup for the select box
ASKER
<select name="contact" style="width: 321px">
<option selected="selected">Please Select An Option</option>
<option value="pastor@domain.com"> The Pastor</option>
<option value="building@domain.com ">The Building Committee</option>
<option value="food@domain.com">Th e Food Pantry</option>
<option value="outreach@domain.com ">The Outreach Committee</option>
</select>
<option selected="selected">Please
<option value="pastor@domain.com">
<option value="building@domain.com
<option value="food@domain.com">Th
<option value="outreach@domain.com
</select>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
yes
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
If I put the following at the top of the page it returns the correct value.
<%
Request.form("Contact")
Response.Write Request("Contact")
%>
If I try to put it down past the "Dim objJMail1" it does not return anything. I have tried changing the code in everyway I can think of but it doesn't work.
<%
Request.form("Contact")
Response.Write Request("Contact")
%>
If I try to put it down past the "Dim objJMail1" it does not return anything. I have tried changing the code in everyway I can think of but it doesn't work.
ASKER
Well I fixed it and you won't believe what it was. In the code it says "If request.form("B1") = "Submit" Then" and on the contact page the submit button code was <input name="B1" type="submit" value="submit" />.
Simply changing it to <input name="B1" type="Submit" value="Submit" /> made it work. Changing that one word from lower to upper case solved the problem.
I am going to award you the points for all your help. Thanks so much for the help.
Simply changing it to <input name="B1" type="Submit" value="Submit" /> made it work. Changing that one word from lower to upper case solved the problem.
I am going to award you the points for all your help. Thanks so much for the help.
ASKER
Thanks guys for the help. Read my last post for the solution.
String comparisons are case sensitive which is why it didn't work until you changed the capitalisation.