Im trying to make a simple form with radio buttons in a JSP-page. After getting it to work, I would like to send the user to a new page called "matematikQuiz", but right now I am just focusing on letting the java know which of the three radio buttons has been pressed. Right now the way I see it, if the user chooses Female and submits it with the submit button, an alert should pop up. But it seems like the getParameter() method isn't working with the radiobuttons. It works fine with pressing the submit button though, but I was told it could check radio buttons as well, given the "name" (gender in my case). Any help would be much appreciated. :-)
<form action="matematikQuiz.jsp" method="post">
<input type="radio" name="gender" value="male"> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other
</form>
<form action="matematikQuiz.jsp" method="post">
<input type="submit" name="sendAnswer" value="Send the answer"></input>
</form>
<%
if (request.getParameter("sendAnswer") != null) {
//button has been pressed.
String yourChoice = request.getParameter("gender");
if ("male".equals("gender")){
//you have selected male.
} else if ("other".equals("gender")){
//you have selected female.
} else if ("female".equals("gender")){
%><script>
alert("you have selected <%=yourChoice%>");
</script>
<%
if ("male".equals(yourChoice)) {.