<?php session_start(); 
if($_SESSION["username"]=="")
{
 	echo "You are not Logged in Please <a href='signin.php'>Sign in </a> First ";
}
elseif($_SESSION["usertype"]=="Parents")
{
 	echo "You are not Authorized This Page <a href='parents.php'>Back </a> ";
}
else
{
include 'dbc.php';
$userid=$_SESSION["userid"];

$sql2="Select * from addsubject where user_id='$userid'";
$data2=mysql_query($sql2) or die ("Error:" . mysql_error());
$rows2=mysql_num_rows($data2);
?>
<HTML>
<HEAD>
<TITLE>MIND TECH SOLUTION</TITLE>
<link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-base.css" />
<link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-topbar.css" />
<link rel="stylesheet" type="text/css" href="ddlevelsfiles/ddlevelsmenu-sidebar.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<style type="text/css">
<!--
.style1 {font-weight: bold}
.style2 {color: #FFFFFF}
.style3 {font-size: 36px}
.style4 {
	font-family: Tahoma;
	font-size: 12px;
	font-weight: bold;
}
-->
</style>
<script type="text/javascript" src="ddlevelsfiles/ddlevelsmenu.js">

/***********************************************
* All Levels Navigational Menu- (c) Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>
<script type="text/javascript">
function check_data()
{
if(document.getElementById("std_rollno").value=="")
{
alert("Field is Compulsary");
document.getElementById("std_rollno").focus();
}
else if(document.getElementById("obt_mark").value=="")
{
alert("Field is Compulsary");
document.getElementById("obt_mark").focus();
}
else if(document.getElementById("total_mark").value=="")
{
alert("Field is Compulsary");
document.getElementById("total_mark").focus();
}

else
{
document.getElementById("app_form").submit();
}
}
</script>

</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<!-- ImageReady Slices (home final.psd) -->
<TABLE WIDTH=1000 BORDER=0 CELLPADDING=0 CELLSPACING=0 align=center>
  <TR>
    <TD COLSPAN=3 bgcolor="#2365ED"><div align="center"><img src="logo copy.jpg" width="134" height="130"></div></TD>
    <TD COLSPAN=9 bgcolor="#2365ED"><table width="561" border="0" align="left">
      <tr>
        <td width="555" height="123" align="center" valign="middle" bgcolor="#2365ED"><p align="center" class="style28"><span class="style37 style3"><strong><h1><font face="Palatino Linotype" color="#FFFFFF"><? echo "" . $_SESSION["userid"]; ?></font></h1></strong></span></p></td>
      </tr>
    </table></TD>
    <TD COLSPAN=2 bgcolor="#2365ED"><a href="http://www.facebook.com"></a></TD>
    <TD><a href="http://www.twitter.com"></a></TD>
    <TD bgcolor="#2365ED"><a href="signin.php">Signout</a><a href="http://www.youtube.com"></a></TD>
  </TR>
  <TR>
    <TD COLSPAN=16 bgcolor="#2365ED"><div id="ddtopmenubar" class="mattblackmenu">
<?php include("includes/menu.php") ?></TD>
  </TR>
  <TR>
    <TD COLSPAN=16 align=center></TD>
  </TR>
  <TR>
    <TD COLSPAN=16 bgcolor="#2365ED">&nbsp;</TD>
  </TR>
  
  <style type="text/css">
<!--
.style2 {color: #FFFFFF}
.style4 {	font-family: Tahoma;
	font-size: 12px;
	font-weight: bold;
}
-->
</style>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="26" colspan="16" bgcolor="#000045"><p align="center" class="style36 style2"><strong> Make Paper form  </strong></p></td>
  </tr>
  <tr>
    <td height="161" colspan="16" valign="top" bgcolor="#FFFF66"><table width="891" border="0" align="center">
	  <form action="enter_question_paper_report.php" method="post" name="app_form" id="app_form">
        <tr>
          <td width="125"><span class="style4">Subject  Name : </span></td>
          <td width="756"><select name="sub_name" id="sub_name">
            <?php
  while($user_data2=mysql_fetch_array($data2))
  {
  ?>
                <option value="<? echo $user_data2['subname']; ?>"><? echo $user_data2["subname"]; ?></option>
                <?php
  }
  ?>
          </select>          </td>
        </tr>
        <tr>
          <td><span class="style4">Class  Name :</span></td>
          <td><span class="style4">
            <select name="class_name" id="class_name">
              <option selected>Play Group</option>
              <option>Nursary</option>
              <option>Prep</option>
              <option>Class 1</option>
              <option>Class 2</option>
              <option>Class 3</option>
              <option>Class 4</option>
              <option>Class 5</option>
              <option>Class 6</option>
              <option>Class 7</option>
              <option>Class 8</option>
              <option>Class 9</option>
              <option>Class 10</option>
            </select>
          </span></td>
        </tr>
        <tr>
          <td><span class="style4">Paper Type    :</span></td>
          <td><label>
            <select name="p_type" id="p_type">
              <option>Subjective</option>
              <option>Objective</option>
            </select>
          </label></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input type="submit" name="Submit" value="Search" onClick="check_data()"/></td>
        </tr>
      </table>
      <p align="center"></form>
      </p>
    </td>
  </tr>
</table>
<?php

include 'dbc.php';

$sub_name=$_POST["sub_name"];
$class_name=$_POST["class_name"];
$p_type=$_POST["p_type"];
$userid=$_SESSION["userid"];
$result = mysql_query("SELECT * FROM qu where sub_name='$sub_name' and class_name='$class_name' and p_type='$p_type' and user_id='$userid' ORDER BY id");
?>
<table width="1000" border="0" cellspacing="1" cellpadding="0" align="center">
<tr>
<td><form name="form1" method="post" action="add_paper1.php">
<table width="1000" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF">&nbsp;</td>
<td colspan="6" bgcolor="#FFFFFF"><strong>Add multiple Question</strong> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">#</td>
<td align="center" bgcolor="#FFFFFF"><strong>Id</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Class </strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Subject</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Type</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Question</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Option</strong></td>
</tr>

<?php
while($rows=mysql_fetch_array($result)){
?>

<tr>
<td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td>
<td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['class_name']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['sub_name']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['p_type']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['question']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['optionn']; ?></td>
</tr>

<?php
}
?>

<tr>
<td colspan="7" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="Add"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<?php

include 'dbc.php';

$today=date("Y-m-d");
$userid=$_SESSION["userid"];
$result = mysql_query("SELECT * FROM add_paper where date='$today' and sub_name='$sub_name' and class_name='$class_name' and user_id='$userid'");
?>
<table width="1000" border="0" cellspacing="1" cellpadding="0" align="center">
<tr>
<td><form name="form1" method="post" action="delete.php">
<table width="1000" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF">&nbsp;</td>
<td colspan="6" bgcolor="#FFFFFF"><strong>Delete multiple</strong> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">#</td>
<td align="center" bgcolor="#FFFFFF"><strong>Id</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Class </strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Subject</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Type</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Question</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Option</strong></td>
</tr>

<?php
while($rows=mysql_fetch_array($result)){
?>

<tr>
<td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td>
<td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['class_name']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['sub_name']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['p_type']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['question']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['optionn']; ?></td>
</tr>

<?php
}
?>

<tr>
<td colspan="7" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="Delete"></td>
</tr>
<tr>
  <td colspan="7" align="center" bgcolor="#FFFFFF"><a href="enter_question_paper_report_print.php">Print Paper</a> </td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<table width="78%" align="center">
<tr>
  <td height="46" colspan="2" bgcolor="#010044">&nbsp;</td>
  <td width="580" rowspan="2" bgcolor="#010044">&nbsp;</td>
</tr>
      <tr>
        <td height="52" bgcolor="#010044">&nbsp;</td>
        <td bgcolor="#010044">&nbsp;</td>
      </tr>
    </table>

</body>
</html>
<?php
}
?>