I have a table called school and a table called students.
I have a foreign key in students called school_id which is connected with table school , field id.
I made a form where field **title** appears to the registration form of the student.
The problem is that i want title to appear as it does but when submiting the form the school_id must be written in the database.
Here is the code:
<select name="SCHOOL_ID" />
<%
Class.forName("com.mysql.jdbc.Driver");
java.sql.Connection connection =java.sql.DriverManager.getConnection("jdbc:mysql://localhost:3306/dbproject1","", "");
String query1 ="SELECT TITLE FROM SCHOOL ";
java.sql.PreparedStatement Stmt1 = connection.prepareStatement(query1);
ResultSet rs = Stmt1.executeQuery();
while (rs.next()) {
out.print("<option>");
out.print(rs.getString("TITLE"));
out.print("</option>");
}
%>
</select>
thank you!