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="">The Pastor</option>
<option value="">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
                  response.redirect "index.asp"
end if

Dim objJMail1
      Set objJMail1 = Server.CreateObject("JMail.SMTPMail")
      objJMail1.ServerAddress = ""
      objJMail1.Sender = request.form("Contact")
      objJMail1.SenderName = "EFBC Online Contact Form"
      objJMail1.AddRecipient request.form("Contact")
'      objJMail1.AddRecipient ""
      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='' width='682' height='149'>"
    objJMail1.HTMLBody = JMail1Body
    objJMail1.Priority = 3
    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?
Mark WoodNetwork AdministratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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 MontyWeb Ninja at largeCommented:
What's the HTML markup for the select box
Mark WoodNetwork AdministratorAuthor Commented:
<select name="contact"  style="width: 321px">

<option selected="selected">Please Select An Option</option>
<option value="">The Pastor</option>
<option value="">The Building Committee</option>
<option value="">The Food Pantry</option>
<option value="">The Outreach Committee</option>

Big MontyWeb Ninja at largeCommented:
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?
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

Mark WoodNetwork AdministratorAuthor Commented:
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:

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.

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.
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.
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.
Mark WoodNetwork AdministratorAuthor Commented:
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.
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

From novice to tech pro — start learning today.