
Hi I'm loges. I'm doing my final year project now, I have some problem in my project and i need some help on it. NowI'm doing a site that allow staff to key in student information such as name,age,gender,nationality,and course taking. I have problem on how to insert the value of gender and nationality into database. By the way, I'm using access database,gender I'm using radio button, and nationality I'm using dropdown list. Please help me. your kindness will be appritiated.

Here is a jsp code that allow the user to select gender and nationality from radio button and dropdown respectively and insert it into database.
1)form.jsp
<html> <form method="post" action="insert.jsp"> <table> <tr><td>Gender: </td><td><input type="radio" value="Male" name="gen">M <input type="radio" value="Female" name="gen">F</td></tr> <tr><td>Nationality: </td><td> <select name="nat"> <option value="Indian">Indian</option> <option value="German">German</option> <option value="Greek">Greek</option> <option value="Chinese">Chinese</option> <option value="Australian">Australian</option> </td></tr> <tr><td><input type="Submit" value="Submit"></td></tr> </form> </html>
2)insert.jsp
<%@page import="java.sql.*"%>
<%
String gen=request.getParameter("gen");
String nat=request.getParameter("nat");
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/register", "root", "root");
Statement stmt = con.createStatement();
int j=stmt.executeUpdate("insert into person(gender,nationality) values('"+gender+"','"+nat+"')");
}
catch(Exception e){}
%>

thank you very much
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.