<?
	include("./config.php");
	include("./function.php");
	$subject=$_POST['subject'];
	$text=$_POST['query_text'];
	$faculty=$_POST['faculty'];
	$login=$_POST['login'];
	$student=get_studname($login);
	$dt=$_POST['txtDate'];
	mysql_query("insert into query (querysubject,querydate,querytext,staffid,studid, querystatus) values('$subject','$dt','$text','$faculty','$student','Unanswered')");

	header("location: ./queries.php?msg=Query Added");
?>
                  <td width="20%" style="border-right:solid 1px #CC0000;"><div align="center">Student</div></td>
                  <td width="15%" style="border-right:solid 1px #CC0000;"><div align="center">Status</div></td>
                  <td width="10%" style="border-right:solid 1px #CC0000;"><div align="center">Detail</div></td>
                  <td width="10%" style="border-right:solid 1px #CC0000;"><div align="center">Edit</div></td>
                  <td width="10%"><div align="center">Delete</div></td>                  
                </tr>
              </table></td>
              <td id="box_right">&nbsp;</td>
            </tr>
            <tr>
              <td colspan="3" width="899px" id="box_border" valign="top" align="center">
              	<div align="center">
                <table border="0"id="border" width="100%">
                <? ini_set('error_reporting', E_ALL ^ ~E_NOTICE ^ ~E_WARNING);
					include("./config.php");
					$result=mysql_query("select * from query where studid='".get_studname($_SESSION['cuser'])."' order by querydate desc");
					while($row=mysql_fetch_array($result))
					{
						echo"<tr><td align='center' width='25%'><a href=./queries_detail.php?id=".$row['queryid'].">".substr($row['querysubject'],0,22)."...</a></td>
						<td align=center width=10%>".$row['querydate']."</td>
						<td align=center width=20%>".$row['studid']."</td>
						<td align=center width=12%>".$row['querystatus']."</td>
						<td align=center width=10%><a href=./queries_detail.php?id=".$row['queryid']."><img src=./images/detail_item.png alt=Detail border=0></a></td>
						<td align=center width=10%><a href=./queries_edit.php?id=".$row['queryid']."><img src=./images/edit_item.png alt=Edit border=0></a></td>
						<td align=center width=10%><a href=./queries_del.php?id=".$row['queryid']."><img src=./images/del_item.png alt=Delete border=0></a></td></tr>";
					}
			
				?>
		        	</table>
        			</div>               </td>
              </tr>