0

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!

2
Contributors
1
Reply
5
Views
7 Years
Discussion Span
Last Post by hielo
0

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>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.