943,201 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Marked Solved
  • Views: 463
  • ASP RSS
Aug 25th, 2010
0

Email recipient based on dropdown list selection

Expand Post »
Hi - new to ASP...

I have a form with a dropdown list. Based on what option is selected I want the form to be send to different email addresses.

Sample code I have is:

asp Syntax (Toggle Plain Text)
  1. <p>Gender: <br>
  2. <select name="gender">
  3. <option selected value="">Choose....</option>
  4. <option name="gender" value="male">Male</option>
  5. <option name="gender" value="female">Female</option>
  6. </select>
  7.  
  8. <%
  9. if request.form ("gender") = ("male") then
  10. %>
  11. <input type="submit" value="Submit" name="btnSubmit" onClick="document.form1.action='send_it.asp'">
  12. <%
  13. else
  14. %>
  15. <input type="submit" value="Submit" name="btnSubmit" onClick="document.form1.action='send_it_female.asp'">
  16. <%
  17. end if
  18. %>

When I test this, the code always goes to the "else" statement.

Any help would be much appreciated!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
lewilaloupe is offline Offline
6 posts
since Aug 2010
Aug 26th, 2010
0
Re: Email recipient based on dropdown list selection
make sure your FORM tag is as shown below and get rid of the name attribute in the option tags
ASP Syntax (Toggle Plain Text)
  1. <form id="form1" action="" method="post">
  2. <p>Gender: <br>
  3. <select name="gender">
  4. <option selected="selected" value="">Choose....</option>
  5. <option value="male">Male</option>
  6. <option value="female">Female</option>
  7. </select>
  8.  
  9. <%
  10. if request.form ("gender") = "male" then
  11. %>
  12. <input type="submit" value="Submit" name="btnSubmit" onClick="document.form1.action='send_it.asp';return true;">
  13. <%
  14. else
  15. %>
  16. <input type="submit" value="Submit" name="btnSubmit" onClick="document.form1.action='send_it_female.asp';return true;">
  17. <%
  18. end if
  19. %>
  20. </form>
Reputation Points: 116
Solved Threads: 243
Veteran Poster
hielo is offline Offline
1,123 posts
since Dec 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: how to connect ms access with asp vbscript
Next Thread in ASP Forum Timeline: asp send email





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC