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:

<p>Gender: <br>
    <select name="gender">
      <option selected value="">Choose....</option>
      <option name="gender" value="male">Male</option>
      <option name="gender" value="female">Female</option>
    </select>

  <% 
if request.form ("gender") = ("male") then
%>
<input type="submit" value="Submit" name="btnSubmit" onClick="document.form1.action='send_it.asp'">
<%
else
%>
<input type="submit" value="Submit" name="btnSubmit" onClick="document.form1.action='send_it_female.asp'">
<%
end if
%>

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

Any help would be much appreciated!

make sure your FORM tag is as shown below and get rid of the name attribute in the option tags

<form id="form1" action="" method="post">
<p>Gender: <br>
    <select name="gender">
      <option selected="selected" value="">Choose....</option>
      <option value="male">Male</option>
      <option value="female">Female</option>
    </select>

<% 
if request.form ("gender") = "male" then
%>
<input type="submit" value="Submit" name="btnSubmit" onClick="document.form1.action='send_it.asp';return true;">
<%
else
%>
<input type="submit" value="Submit" name="btnSubmit" onClick="document.form1.action='send_it_female.asp';return true;">
<%
end if
%>
</form>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.