maruf22

$sessionName = $_SESSION['NAME'];
$date = date('d-m-y');
$loc= $_POST['locationID'];
$name = $_REQUEST['name'];
$status = $_POST['status'];
$class = $_POST['class'];
$section = $_POST['section'];

$i = 0;
while($i<count($loc)){

  $session = mysql_real_escape_string($sessionName[$i]);
   $fdate = mysql_real_escape_string($date[$i]);
    $location = mysql_real_escape_string($loc[$i]);

     $sts = mysql_real_escape_string($status[$i]);
    $cls = mysql_real_escape_string($class[$i]);
    $sec = mysql_real_escape_string($section[$i]);

    $query = "INSERT INTO `tbl_attendence` ( 
       `fld_studentname`, `fld_status`, `fld_class`, `fld_section`, `fld_date`, `fld_takenby`
        ) VALUES (
         '$session',
        '$sts',
        '$cls',
        '$sec',
        '$fdate',
        '$name'
            )
        "; 

    mysql_query($query);          
    $i++;  
}

if(mysql_affected_rows()>0){
    echo "Attendance Updated Successfully";
} else {
    echo "There was an error updating attendance.please contact with server admin or try again";
    echo "<br><br>Error: " . mysql_error();
    echo "<br><br>Query: " . $query;
} 

here i assume $name is for fld_takenby ,i will appreciate if you please let me know the result.