<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 fqn=f1.fqno.value;

		var fq=f1.fqname.value;

                var ans=f1.ans.value;
                if(fqn==null || fqn=="" || fq==null || fq=="" )
                    window.alert("PLEASE ENTER THE FIELDS");
                else
                   document.forms["f1"].submit();



		
        }
</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;
}
input {border:5px;color:red;padding:2px}
select {border:5px;color:red;padding:2px}
</style>
</head>
<body bgcolor="black">
<%@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 fqb");

                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("load error");
   	 }
		catch(SQLException e)
               {
	            out.println(e);
                }
%>

    <% if(request.getAttribute("sree")!=null)
                   out.println(request.getAttribute("sree"));%>

                 <center> <div><form action="ffinsert.jsp" name="f1" method=post">
                       Fill in the Blanks
               <table align="center" width="600">
               <tr><td align="right">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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
                  </select></td></tr>
               <tr><td align="left">Enter the Question No</td><td><input type=text name=fqno value="<%=k%>" size=25></td></tr>
               <tr><td>Enter the Question </td><td><textarea name="fqname" rows="4" cols="20"></textarea></td></tr>
               <tr><td>Enter the Answer</td><td><input type=text name=ans length=350 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></center>
       





</body>
</html>