<?php
include_once('dbconfig.php');
$Feed=$_POST['Feed'];
$Update=$_POST['Update'];
$sid = $_POST['sid'];
$id = $_POST['id'];
$date = $_POST['date'];
$status = $_POST['status'];
$college_id= $_POST['college_id'];
$college_type= $_POST['college_type'];
$course_name= $_POST['course_name'];
$Course_Details= $_POST['Course_Details'];
$subject= $_POST['subject'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
if($Feed!='') {




$queries = array();

for ($i = 0; $i < count($sid); $i++) {
if (!get_magic_quotes_gpc()) {
$sid[$i] = addslashes($sid[$i]);
$status[$i] = addslashes($status[$i]);
$date[$i] = addslashes($date[$i]);
$classt[$i] = addslashes($classt[$i]);
$section[$i] = addslashes($section[$i]);
# etc
}
$queries[] = "('$sid[$i]','$status[$i]','$date[$i]','$college_id','$college_type','$course_name','$Course_Details','$subject','$code','$session')";
}

if (count($queries) == 0) {
# Nothing passed
# exit
}
$piece = implode(", ", $queries);
$query = "INSERT INTO att (sid,status,date,college_id,college_type,course_name,Course_Details,subject,code,session) VALUES $piece";
$result = mysql_query($query) or die(mysql_error());
?>

<?php
}

if($Update!='') {
Echo "----------------Update";


echo $status;
for ($i = 0; $i < count($id); $i++) {
$sql1="UPDATE att SET status='$status[$i]' WHERE id='$id[$i]' and session='$session' and code='$code'";
$result1=mysql_query($sql1);
?>
<?php }

}
?><script type="text/javascript">
         <!--
            function Redirect() {
               window.location="stu_att_1.php?<?php echo "day=$day&month=$month&year=$year&college_id=$college_id&college_type=$college_type&course_name=$course_name&Course_Details=$Course_Details&subject=$subject&btnSave=Get++List";?>";
            }
            
            document.write("<h1>You will be redirected to main page in 10 sec.</h1>");
            setTimeout('Redirect()', 500);
         //-->
      </script>