Link to home
Start Free TrialLog in
Avatar of Mark Wood
Mark WoodFlag for United States of America

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---------->&nbsp;" & request.form("Email") & "<br>"
    JMail1Body=JMail1body & "Phone Number----------->&nbsp;" & 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?
Avatar of Big Monty
Big Monty
Flag of United States of America image

What's the HTML markup for the select box
Avatar of Mark Wood

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">The Food Pantry</option>
<option value="outreach@domain.com">The Outreach Committee</option>

</select>
SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
yes
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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.
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.