0

HI guys ,
i'm new to this community. plz help :'(
i'm doing a project which is called Online Examination..
can i give a variable as value in radio button????
Here is my code

<%
        

        try{
        int num;
double d=Math.random()*10;
PrintWriter oo=response.getWriter();

        num=(int)d;
        
        
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            Connection con=DriverManager.getConnection("jdbc:odbc:mno");
            Statement stmt=con.createStatement();
            ResultSet rs=stmt.executeQuery("select * from test where Q_NO="+num+"");
     

     
     while(rs.next()){
     out.println("Question_No : "+rs.getInt(1));
     out.println("<br>");
     out.println("Question : "+rs.getString(2));
     out.println("<br>");
     out.println("<br>");
     
 out.println("<input type='radio' name='n1' value="+rs.getString(3)+"/>")

            /*when i give value as code above in radio button, the below code is not
                displaying*/

     out.println(rs.getString(3));
     out.println("<br>");
     out.println("<input type='radio' name='n1'>");
     
     out.println(rs.getString(4));
     out.println("<br>");
     out.println("<input type='radio' name='n1'>");
     
     out.println(rs.getString(5));
     out.println("<br>");
     out.println("<input type='radio' name='n1'>");
     
     out.println(rs.getString(6));
     out.println("<br>");
     String a=rs.getString(3);
}
     }catch(Exception e){}
  
  %>

Help me PLZ.......

Thanks in advance...

Manoj

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by peter_budo
0

try to give like this:

out.println("<input type=\"radio\" name=\"n1\" value=\""+rs.getString(3)+"\"/>");
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.