<jsp:include page="menu.jsp"></jsp:include><html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        
        <script LANGUAGE="JavaScript">
        function fun()
        {
                var mqn=f1.mqno.value;
             
		var mq=f1.mqname.value;
                
                var mans=f1.ans.value;
             
		
                var o1=f1.opt1.value;
             
		var o2=f1.opt2.value;
                
                var o3=f1.opt3.value;
             
		var o4=f1.opt4.value;
                
		if(mqn==null || mq==null || mans==null || o1==null || 02==null || 03==null || o4==null || mqn=="" || mq=="" || mans=="" || o1=="" || 02=="" || 03=="" || o4=="")
                    window.alert("please enter the fields");
                else
                {
		    
                      document.forms["f1"].submit();
                }
        
        }
        function fun2()
        {
          //  window.alert("si");
            
            var a1=document.f1.opt[0].checked;
            var a2=document.f1.opt[1].checked;
            var a3=document.f1.opt[2].checked;
            var a4=document.f1.opt[3].checked;
           if(a1)
             document.f1.ans.value  =f1.opt1.value;
           else if(a2)
               document.f1.ans.value  =f1.opt2.value;
             else if(a3)
             document.f1.ans.value  =f1.opt3.value;
           else if(a4)
               document.f1.ans.value  =f1.opt4.value;
              
            /*/else if(document.f1.opt[1].checked)
                a=f1.opt2.value;
             document.f1.ans.value=a;
            else if(document.f1.opt[2].checked)
             a=f1.opt3.value;
             f1.ans.value=a;
             else if(document.f1.opt[3].checked)
               a=f1.opt2.value;
             f1.ans.value=a;*/
            
        }
</script>
        <style>
div
{
color:white;
width:180;
font-family:Comic Sans MS;
text-align:center;
}
a
{
text-decoration:none;
font-family:Comic Sans MS;
color:black;
cursor:hand;
}

</style>
</head>
<body bgcolor="#123456">
    <%@page language="java" import="java.util.*,java.sql.* " contentType="text/html"%>

<%         
            String k="";
           try {

               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

            Connection con=DriverManager.getConnection("jdbc:odbc:sree","sree","sree");

                PreparedStatement pstmt = con.prepareStatement("select max(qid) from mqb");
                ResultSet rs= pstmt.executeQuery();
                while(rs.next())
                {
                    int  i=rs.getInt(1);
                    int l=i+1;
                    k=String.valueOf(l);
              }

            }
           
         catch(ClassNotFoundException s)
         {
	        out.println("loaderror");
   	 }
		catch(SQLException e)
               {
	            out.println(e);
               }
%>

    <% if(request.getAttribute("sri")!=null)
                   out.println(request.getAttribute("sri"));%>
                   <br><br><center><div>Multiple Choice Qos</div></center><br><br><br>
                   <div><form action="mminsert.jsp" name="f1" method=post">
      <table align="center" width="600">
      <tr><td>Section</td><td><select name="sec">
<option value="English">English</option>
<option value="Aptitude">Aptitude</option>
<option value="G.K.">G.K.</option>
<option value="Railway">Railways</option>
</select></td></tr>
      <tr><td>Enter the Question No</td><td><input type=text name=mqno value="<%=k%>" length=300 size=25></td></tr>
      <tr><td>Enter the Question </td><td><textarea name="mqname" rows="4" cols="20">
</textarea></td></tr>
      
      <tr><td></td></tr>
      <tr><td> Enter the Option1</td><td><input type="radio" name="opt" value="0"  onclick="fun2()" /><input type=text name=opt1 length=300 size=22></td></tr>
      <tr><td> Enter the Option2</td><td><input type="radio" name="opt" value="1"  onclick="fun2()" /><input type=text name=opt2 length=300 size=22></td></tr>
      <tr><td> Enter the Option3</td><td><input type="radio" name="opt" value="2"  onclick="fun2()" /><input type=text name=opt3 length=300 size=22></td></tr>
      <tr><td> Enter the Option4</td><td><input type="radio" name="opt" value="3"  onclick="fun2()" /><input type=text name=opt4 length=300 size=22></td></tr>
      <tr><td> Enter the Answer</td><td><input type=text name=ans length=300 readonly size=25></td></tr>
      <tr><td></td><td><input type="button" value="confirm" onclick="fun()" name="Confirm" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input type="reset" value="cancel" name="Cancel" /></td></tr>
           </table>
    </form></div>
       
   

              
 
   
</body>
</html>