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

try to give like this:

out.println("<input type=\"radio\" name=\"n1\" value=\""+rs.getString(3)+"\"/>");

@Manojo7 you better pick up some more up-to-date book as nobody these days does Java web development by writing html into Java
Something like Head First Servlet & JSP would be good choice

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.