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?
LVL 2
Mark WoodNetwork AdministratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
What's the HTML markup for the select box
0
Mark WoodNetwork AdministratorAuthor Commented:
<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>
0
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
If you put

Response.Write Request("contact")

at the top of your code does the email address get written out when you submit the form?
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Mark WoodNetwork AdministratorAuthor Commented:
yes
0
ChloesDadCommented:
In your code you have request,form("contact") that sets nothing and then add Response.Write Request("contact") which does give the correct value then change the line in the code to Request("contact").

All variables can be accessed directly by calling Request(variable) without the collection name. In this case, the Web server searches the collections in the following order:
•QueryString
•Form
•Cookies
•ClientCertificate
•ServerVariables

If a variable with the same name exists in more than one collection, the Request object returns the first instance that the object encounters.

It could be that the required variable is somehow not in the form collection.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mark WoodNetwork AdministratorAuthor Commented:
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.
0
Mark WoodNetwork AdministratorAuthor Commented:
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.
0
Mark WoodNetwork AdministratorAuthor Commented:
Thanks guys for the help. Read my last post for the solution.
0
ChloesDadCommented:
String comparisons are case sensitive which is why it didn't work until you changed the capitalisation.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.