0

sir i a student of 4th year i need some help in my project i m creating a online quiz 30 question and each question have 6 options which are check boxes and question have more then 1 ans so ,i ll select more then one check box so that how can i store this 30 questions which have multiple values how i can store this values at once please help me sir please please please help me i request u all help

2
Contributors
4
Replies
8
Views
5 Years
Discussion Span
Last Post by shadab550
0

Multiple possible approaches just from top of head:

  • Single table with columns - id, question, answer A,.... answer F, correct answer (A, C, D) will require the answer string to be split into array by comma "," delimiter
  • Two tables
    Table 1 - id, question, answer A,.... answer F
    Table 2 - id, answer A(boolean).... answer F(boolean), where boolean represent if answer is true or false

Given that you are in 4th year one would presume you can think more pragmatically...

PS: I'm sure you read forum rules, but you may have missed this one Do provide evidence of having done some work yourself if posting questions from school or work assignments

Edited by peter_budo: n/a

0

sir actually i m nt doing my academic project just trying to make a online quiz and wht u suggested i m nt getting n this is my first page how i m retrieving my checkbox dynamically n when i m inserting that is going into diff row but i want to insert multiple answ of question into one feild and multiple ans of second into second field upto 30 question and my code is show below

<body>
         <form method="post" action="result.jsp">
<table>
<%
Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/Myfirstapp;create=true");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("Select * from test");
int i=1;
while(rs.next()){
%>
 <%=i%> <%=rs.getString("ques")%><br> 
      &nbsp;<input type="checkbox" value="<%=rs.getString("opt1")%>" name="radio"/><%=rs.getString("opt1")%> <br>
      &nbsp;<input type="checkbox" value="<%=rs.getString("opt2")%>" name="radio"/><%=rs.getString("opt2")%> <br>
      &nbsp;<input type="checkbox" value="<%=rs.getString("opt3")%>" name="radio"/><%=rs.getString("opt3")%> <br>
      &nbsp;<input type="checkbox" value="<%=rs.getString("opt4")%>" name="radio"/><%=rs.getString("opt4")%> <br>
      &nbsp;<input type="checkbox" value="<%=rs.getString("opt5")%>" name="radio"/><%=rs.getString("opt5")%> <br>
      &nbsp;<input type="checkbox" value="<%=rs.getString("opt6")%>" name="radio"/><%=rs.getString("opt6")%> <br>
<%
i++;
}
%>
<tr><td><input type="submit" value="submit"></td></tr>

n for inserting i m just using try catch in try catch connectivity n insert with prepared stmt plzz give me some suggestions how to do that

Edited by peter_budo: Keep It Clear - Do use code tags when posting any code

0

k sir i will from next time i will remember it and sir any suggestion

Edited by shadab550: n/a

This topic has been dead for over six months. 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.