Your IP : 10.1.73.149


Current Path : /home/bolconlineco/public_html/student/
Upload File :
Current File : //home/bolconlineco/public_html/student/studentInfoOLD.php

<?php
ob_start();
session_start();
if(!isset($_SESSION['studentname']) || $_SESSION['studentrole'] != 4)
{
    header("location:../index.php");
    exit();
}
include('../includes/connection/func.inc.php');
require '../emails/PHPMailerAutoload.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Brentwood </title>
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css"/>
<link href="../assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<link href="../assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="../assets/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN PAGE LEVEL PLUGIN STYLES -->
<link href="../assets/plugins/gritter/css/jquery.gritter.css" rel="stylesheet" type="text/css"/>
<link href="../assets/plugins/bootstrap-daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css"/>
<link href="../assets/plugins/fullcalendar/fullcalendar/fullcalendar.css" rel="stylesheet" type="text/css"/>
<link href="../assets/plugins/jqvmap/jqvmap/jqvmap.css" rel="stylesheet" type="text/css"/>
<link href="../assets/plugins/jquery-easy-pie-chart/jquery.easy-pie-chart.css" rel="stylesheet" type="text/css"/>
<!-- END PAGE LEVEL PLUGIN STYLES -->
<!-- BEGIN THEME STYLES -->
<link href="../assets/css/style-metronic.css" rel="stylesheet" type="text/css"/>
<link href="../assets/css/style.css" rel="stylesheet" type="text/css"/>
<link href="../assets/css/style-responsive.css" rel="stylesheet" type="text/css"/>
<link href="../assets/css/plugins.css" rel="stylesheet" type="text/css"/>
<link href="../assets/css/pages/tasks.css" rel="stylesheet" type="text/css"/>
<link href="../assets/css/themes/default.css" rel="stylesheet" type="text/css" id="style_color"/>
<link href="../assets/css/print.css" rel="stylesheet" type="text/css" media="print"/>
<link href="../assets/css/custom.css" rel="stylesheet" type="text/css"/>
<!-- END THEME STYLES -->
<link rel="shortcut icon" href="favicon.ico"/>
<link rel="stylesheet" href="../css/main.css" type="text/css" />
<link href="../tabs/styles.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="../tabs/jquery-ui-1.css" type="text/css" media="all">
<script src="../js/jquery-1.8.2.min.js" type="text/javascript"></script>
<script>

    $("document").ready(function(){
        $("#nte tr:odd").addClass('high');
    });

    $(function() {

        $("#tabs").tabs({ fx: { height: 'toggle', opacity: 'toggle' } });
    });
     $(document).ready(function(){
         $(".ui-corner-top");
         $(".ui-corner-all");

    })
</script>

    <!-- CSS goes in the document HEAD or added to your external stylesheet -->
    <style type="text/css">
        table.altrowstable {
            font-family: verdana,arial,sans-serif;
            font-size:11px;
            color:#333333;
            border-width: 1px;
            border-color: #a9c6c9;
            border-collapse: collapse;
        }
        table.altrowstable th {
            border-width: 1px;
            padding: 8px;
            border-style: solid;
            border-color: #a9c6c9;
        }
        table.altrowstable td {
            border-width: 1px;
            padding: 8px;
            border-style: solid;
            border-color: #a9c6c9;

        }
        .oddrowcolor{
            background-color:#d4e3e5;
        }
        .evenrowcolor{
            background-color:#c3dde0;
        }
    </style>




</head>

<?php
$co=$_SESSION['studentname'];
$r=mysql_query("select * from student where email='$co'");
$rr=mysql_fetch_array($r);
$t=$rr['title'];
$fname=$rr['fname'];
$lname=$rr['lname'];

$fullname=$fname.' '.$lname;
$rollno=$rr['rollno'];
?>

<body class="page-header-fixed">
    <!-- BEGIN HEADER -->
    <div class="header navbar navbar-fixed-top">
        <!-- BEGIN TOP NAVIGATION BAR -->
        <div class="header-inner">
            <!-- BEGIN LOGO -->
            <a class="navbar-brand" href="dashboard.php" class="logo_admin">
                <span class="logo_first" style="color: #fff;">Brentwood</span>
            </a>
            <!-- END LOGO -->
            <!-- BEGIN RESPONSIVE MENU TOGGLER -->
            <a href="javascript:;" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <img src="../assets/img/menu-toggler.png" alt=""/>
            </a>
            <ul class="nav navbar-nav pull-right">
                <li class="dropdown user">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-Hover="dropdown" data-close-others="true">


                        <i class="fa fa-angle-down"></i>
                    </a>
                    <ul class="dropdown-menu">



                        <li>
                            <a href="javascript:;" id="trigger_fullscreen">
                                <i class="fa fa-arrows"></i> Full Screen
                            </a>
                        </li>

                        <li>
                            <a href="logout.php">
                                <i class="fa fa-key"></i> Log Out
                            </a>
                        </li>

                    </ul>
                </li>
            </ul>
            <!-- END RESPONSIVE MENU TOGGLER -->
        </div>
        <!-- END TOP NAVIGATION BAR -->
    </div>
    <!-- END HEADER -->
    <div class="clearfix">
    </div>
    <!-- BEGIN CONTAINER -->
<div class="page-container">
    <!-- BEGIN SIDEBAR -->
<?php include ("sidebar.php"); ?>
    <!-- END SIDEBAR -->
    <!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<div class="page-content">

    <!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
    <!-- BEGIN STYLE CUSTOMIZER -->

    <!-- END STYLE CUSTOMIZER -->

    <!-- BEGIN DASHBOARD STATS -->

    <!-- END DASHBOARD STATS -->
<div class="clearfix">
<div class="row" id="con_id">
<div class="col-md-12">
</div>
<div class="row">
<div class="col-md-12">
<!-- BEGIN EXAMPLE TABLE PORTLET-->
<div class="portlet box blue">
<div class="portlet-title">
    <div class="caption"> <i class="fa fa-globe"></i>Feedback</div>
</div>
<div class="portlet-body">

    <?php
    if(isset($_GET['e'])) { ?>
        <span class="alert alert-danger">This Email is already registerd</span>
    <?php
        echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id';\",2500);</script>";
    } ?>


   

    <div style="-moz-border-radius: 10px 10px 10px 10px; width:900px" class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs">

    <?php

    if(isset($_SESSION['studentstatus']) && $_SESSION['studentstatus'] == 5 ){ ?>

        <ul style="-moz-border-radius: 10px 10px 10px 10px;" class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
            <li style="-moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px;" class="ui-corner-top ui-tabs-selected ui-state-active"><a href="#tabs-1">Personal Details</a></li>
            <li style="-moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px;" class="ui-corner-top ui-state-default"><a href="#ui-tabs-9">Employment Details</a></li>
            <li style="-moz-border-radius-topleft: 10px; display:none; -moz-border-radius-topright: 10px;" class="ui-corner-top ui-state-default"><a href="#ui-tabs-8">Fee Details</a></li>
            <li style="-moz-border-radius-topleft: 10px; display:none; -moz-border-radius-topright: 10px;" class="ui-corner-top ui-state-default"><a href="#ui-tabs-3">Course Details</a></li>
            <li style="-moz-border-radius-topleft: 10px; display:none; -moz-border-radius-topright: 10px;" class="ui-corner-top ui-state-default"><a href="#ui-tabs-31">Inbox</a></li>
        </ul>

    <?php
	 }
    elseif(isset($_SESSION['studentstatus']) && $_SESSION['studentstatus'] == 6){
		
     ?>
        <ul style="-moz-border-radius: 10px 10px 10px 10px;" class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
            <li style="-moz-border-radius-topleft: 10px; display:none; -moz-border-radius-topright: 10px;" class="ui-corner-top ui-tabs-selected ui-state-active"><a href="#tabs-1">Personal Details</a></li>
            <li style="-moz-border-radius-topleft: 10px; display:none; -moz-border-radius-topright: 10px;" class="ui-corner-top ui-state-default"><a href="#ui-tabs-9">Employment Details</a></li>
            <li style="-moz-border-radius-topleft: 10px; display:none; -moz-border-radius-topright: 10px;" class="ui-corner-top ui-state-default"><a href="#ui-tabs-8">Fee Details</a></li>
            <li style="-moz-border-radius-topleft: 10px;   -moz-border-radius-topright: 10px;" class="ui-corner-top ui-state-default"><a href="#ui-tabs-3">Course Details</a></li>
            <li style="-moz-border-radius-topleft: 10px;display:none;  -moz-border-radius-topright: 10px;" class="ui-corner-top ui-state-default"><a href="#ui-tabs-31">Inbox</a></li>
        </ul>

<?php
	 }
    else if(isset($_GET['email'])){
		
     ?>
        <ul style="-moz-border-radius: 10px 10px 10px 10px;" class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
            <li style="-moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px;" class="ui-corner-top ui-state-default"><a href="#tabs-1">Personal Details</a></li>
            <li style="-moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px;" class="ui-corner-top ui-state-default"><a href="#ui-tabs-9">Employment Details</a></li>
            <li style="-moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px;" class="ui-corner-top ui-state-default"><a href="#ui-tabs-8">Fee Details</a></li>
            <li style="-moz-border-radius-topleft: 10px;   -moz-border-radius-topright: 10px;" class="ui-corner-top ui-state-default"><a href="#ui-tabs-3">Course Details</a></li>
            <li style="-moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px;"  class="ui-corner-top ui-tabs-selected ui-state-active"><a href="#ui-tabs-31">Inbox</a></li>
            <li style="-moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px;"  class="ui-corner-top ui-state-default"><a href="#ui-tabs-5">Outbox</a></li>
        </ul>


    <?php
	 }
	  else{ ?>

        <ul style="-moz-border-radius: 10px 10px 10px 10px;" class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
            <li style="-moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px;" class="ui-corner-top ui-tabs-selected ui-state-active"><a href="#tabs-1">Personal Details</a></li>
            <li style="-moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px;" class="ui-corner-top ui-state-default"><a href="#ui-tabs-9">Employment Details</a></li>
            <li style="-moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px;" class="ui-corner-top ui-state-default"><a href="#ui-tabs-8">Fee Details</a></li>
            <li style="-moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px;" class="ui-corner-top ui-state-default"><a href="#ui-tabs-3">Course Details</a></li>
            <li style="-moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px;" class="ui-corner-top ui-state-default"><a href="#ui-tabs-31">Inbox</a></li>
            <li style="-moz-border-radius-topleft: 10px; -moz-border-radius-topright: 10px;"  class="ui-corner-top ui-state-default"><a href="#ui-tabs-5">Outbox</a></li>
        </ul>
    <?php } ?>


    <div style="" id="tabs-1" class="tabsContent ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"><ul class="thumbs">
    <?php
    $id=$rr['rollno'];
    $query="SELECT * FROM student where rollno='$id'";
    $reslt=mysql_query($query) or die(mysql_error());
    $fetch=mysql_fetch_array($reslt);
    extract($fetch);
    $query2="select * from course where courseId=(select courseid from assigncourse where rollno='$rollno')";
    $rr=mysql_query($query2) or die(mysql_error());
    $resultSEt=mysql_fetch_array($rr);
    ?>
    <?php
    if(isset($_POST['registrationdate']))
    {
        $newRegist=sql_strip($_POST['registdate']);
        $old=sql_strip($_POST['oldregist']);
        $query="update student set registrationdate='$newRegist' where registrationdate='$old' and rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();
    }

    if(isset($_POST['postcodeupdate']))
    {
        $postcodes=sql_strip($_POST['postcodes']);
        $oldrepostcode=sql_strip($_POST['oldrepostcode']);
        $query="update student set postcode='$postcodes' where postcode='$oldrepostcode' and rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();
    }
    if(isset($_POST['updatefname']))
    {
        $firstname=$_POST['firstname'];
        $oldfname=$_POST['oldfname'];
        $query="update student set fname='$firstname' where fname='$oldfname' and rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();
    }
    if(isset($_POST['updatelname']))
    {
        $lastname=$_POST['lastname'];
        $oldlname=$_POST['oldlname'];
        $query="update student set lname='$lastname' where lname='$oldlname' and rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();
    }

    if(isset($_POST['updatedob']))
    {
        //$newdob=date('Y-m-d',strtotime($_POST['newdob']));
        $month=$_POST['month'];
        $day=$_POST['day'];
        $year=$_POST['year'];
        $newdob=$year.'-'.$month.'-'.$day;
        $query="update student set dob='$newdob' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();
    }
    if(isset($_POST['updateaddress1']))
    {
        $newaddress1=$_POST['newaddress1'];
        $oldaddress1=$_POST['oldaddress1'];
        $query="update student set address='$newaddress1' where address='$oldaddress1' and rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();
    }
    if(isset($_POST['updatecity']))
    {
        $newcity=$_POST['newcity'];
        $oldcity=$_POST['oldcity'];
        $query="update student set city='$newcity' where city='$oldcity' and rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();
    }
    if(isset($_POST['updatecountry']))
    {
        $newcountry=$_POST['newcountry'];
        //$oldlname=$_POST['oldlname'];
        $query="update student set country='$newcountry' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();
    }
    if(isset($_POST['updatephone']))
    {
        $phone=$_POST['phone'];
        $query="update student set phone='$phone' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();
    }
    if(isset($_POST['updatemobile']))
    {
        $mobile=$_POST['mobile'];
        $query="update student set mobile='$mobile' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();
    }
    if(isset($_POST['updatest']))
    {
        $studstatus=$_POST['studstatus'];

        $query="update student set studentstatus='$studstatus' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();
    }
    if(isset($_POST['updateemail']))
    {
        /*
          $newemail=$_POST['newemail'];
        $oldemail=$_POST['oldemail'];
        $query="update student set email='$newemail' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        $qq="update admin set username='$newemail' where username='$oldemail'";
        $rr=mysql_query($qq) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();
        */

        $email=$_POST['newemail'];
        $oldemail=$_POST['oldemail'];
        if($email==$oldemail)
        {
            echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
        }else
        {
            $sql="select * from programe_co where email='$email'";
            $rresult=mysql_query($sql) or die(mysql_error());
            $sql1="select tutorId from tutor where email='$email'";
            $rr=mysql_query($sql1) or die(mysql_error());
            $sql="select SId from student where email='$email'";
            $result=mysql_query($sql) or die(mysql_error());
            if(mysql_num_rows($rresult) > 0 )
            {
                echo "<script>window.location.href='studentInfo.php?e&Id=$id'</script>";
            }elseif(mysql_num_rows($rr) > 0 )
            {
                echo "<script>window.location.href='studentInfo.php?e&Id=$id'</script>";
            }elseif(mysql_num_rows($result) > 0 )
            {
                echo "<script>window.location.href='studentInfo.php?e&Id=$id'</script>";
            }else
            {
                $oldemail=$_POST['oldemail'];
                $query="update student set email='$email' where rollno='$id'";
                $result=mysql_query($query) or die(mysql_error());
                $qq="update admin set username='$email' where username='$oldemail'";
                $rr=mysql_query($qq) or die(mysql_error());
                //header("location:studentInfo.php?Id=$id");
                //exit();

                /*echo "<script>window.location.href='studentInfo.php?Id=$id&ok'</script>";*/
                echo "<script>window.location.href='../index.php'</script>";

            }
        }
    }
    if(isset($_POST['updatetitle']))
    {

        $title=$_POST['title'];
        $query="update student set jobtitle='$title' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();
    }

    if(isset($_POST['updatecomp']))
    {
        $companyname=$_POST['companyname'];
        $query="update student set companyname='$companyname' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();

    }
    if(isset($_POST['upadd1']))
    {
        $addline1=$_POST['addline1'];
        $query="update student set addressline1='$addline1' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();
    }

    if(isset($_POST['updateaddressline2']))
    {
        $addressline2=$_POST['addressline2'];
        $query="update student set addressline2='$addressline2' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();
    }
    if(isset($_POST['updateaddressline3']))
    {
        $addressline3=$_POST['addressline3'];
        $query="update student set addressline3='$addressline3' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();

    }
    if(isset($_POST['updatee-City']))
    {
        $ecity=$_POST['ecity'];
        $query="update student set ecity='$ecity' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();

    }
    if(isset($_POST['epostcode']))
    {
        $ecode=$_POST['ecode'];
        $query="update student set epostcode='$ecode' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();

    }
    if(isset($_POST['updatemecountry']))
    {
        $ecountry=$_POST['ecountry'];
        $query="update student set ecountry='$ecountry' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id");
        exit();

    }
    ?>
    <table width="650" border="0" id="personnaldetails" class="tablestyle">
    <tr>
        <td id="col">Registration Date:</td>
        <td id="col2"><?php
            /*
              if(isset($_POST['submit-1']))
               {
                      $rr=$_POST['regist'];
                ?>
                <form action="" method="post">
                <input type="text" name="registdate" value="<?php echo $rr; ?>" class="inp" />
                <input type="hidden" name="oldregist" value="<?php echo $rr; ?>" />
                <input type="submit" name="registrationdate" value="Update" class="add" />
                </form>
                <?php

                }else{
                    */
            echo date('d/m/Y',strtotime($registrationdate));
            /*
       }
       ?>
         </td>
   <td>
   <?php if(!isset($_POST['submit-1']))
    {
        ?>
   <form action="" method="post">
   <div id="btn">
   <input type="hidden" name="regist" value="<?php echo $registrationdate; ?>" />
    <input type="submit" name="submit-1" class="add inp" value="Edit" />
   </div>
   </form>
   <?php
    }else{
       ?>

       <?php
    }*/
            ?>
        </td>
        <td>
            <?php /* if(isset($_POST['submit-1'])){
		$rr=$_POST['regist'];
		?>
        <form action="" method="post">
        <input type="text" name="registdate" value="<?php echo $rr; ?>" />
        <input type="hidden" name="oldregist" value="<?php echo $rr; ?>" />
        <input type="submit" name="registrationdate" value="Update" class="add" />
        </form>
        <?php
		}*/?>
        </td>
    </tr>
    <tr>
        <td id="col">StudentID:</td>
        <td id="col2"><?php echo $rollno;?></td>
    </tr>
    <tr>
        <td id="col">Course:</td>
        <td id="col2"><?php echo $resultSEt['courseName'];?></td>
    </tr>
    <tr>
        <td id="col">First Name:</td>
        <td id="col2"><?php
            /*
              if(isset($_POST['submit-3']))
               {
                      $firstname=$_POST['firstname'];
                ?>
                <form action="" method="post">
                <input type="text" name="firstname" value="<?php echo $firstname; ?>" />
                <input type="hidden" name="oldfname" value="<?php echo $firstname; ?>" />
                <input type="submit" name="updatefname" value="Update" class="add" />
                </form>
                <?php

                }else{*/
            echo $fname;
            /*
       }
       ?></td>
   <td><?php if(!isset($_POST['submit-3']))
    {
        ?>
   <form action="" method="post">
   <div id="btn">
   <input type="hidden" name="firstname" value="<?php echo $fname; ?>" />
    <input type="submit" name="submit-3" class="add" value="Edit" />
   </div>
   </form>
   <?php
    }else{
       ?>

       <?php
    }*/
            ?></td>
    </tr>
    <tr>
        <td id="col">Last Name:</td>
        <td id="col2"><?php
            /*
              if(isset($_POST['submit-4']))
               {
                      $lname=$_POST['lname'];
                ?>
                <form action="" method="post">
                <input type="text" name="lastname" value="<?php echo $lname; ?>" />
                <input type="hidden" name="oldlname" value="<?php echo $lname; ?>" />
                <input type="submit" name="updatelname" value="Update" class="add" />
                </form>
                <?php

                }else{*/
            echo $lname;
            /*
       }
       ?></td>
   <td><?php if(!isset($_POST['submit-4']))
    {
        ?>
   <form action="" method="post">
   <div id="btn">
   <input type="hidden" name="lname" value="<?php echo $lname; ?>" />
    <input type="submit" name="submit-4" class="add" value="Edit" />
   </div>
   </form>
   <?php
    }else{
       ?>

       <?php
    }*/
            ?></td>
    </tr>
    <tr>
        <td id="col">Date OF Birth:</td>
        <td id="col2"><?php
            if(isset($_POST['submit-5']))
            {
                $dateob=$_POST['dateob'];
                $full=explode('-',$dateob);
                ?>
                <form action="" method="post">
                    <select name="day">
                        <option value="<?php echo $full[2]; ?>"><?php echo $full[2];?></option>
                        <?php
                        for( $d=01; $d<=31; $d++)
                        {
                            ?>
                            <option value="<?php echo str_pad($d,2,'0',STR_PAD_LEFT);?>"><?php echo str_pad($d,2,'0',STR_PAD_LEFT);?></option>
                        <?php
                        }

                        ?>
                    </select>
                    <select name="month">
                        <option value="<?php echo $full[1];?>"><?php echo $full[1];?></option>
                        <?php
                        for( $d=01; $d<=12; $d++)
                        {
                            ?>
                            <option value="<?php echo str_pad($d,2,'0',STR_PAD_LEFT);?>"><?php echo str_pad($d,2,'0',STR_PAD_LEFT);?></option>
                        <?php
                        }

                        ?>


                    </select>
                    <select name="year">
                        <option value="<?php echo $full[0]; ?>"><?php echo $full[0];?></option>
                        <?php
                        for($d=date("Y"); $d>=1960; $d--)
                        {
                            if($full[0]==$d)
                            {
                            }else{
                                ?>
                                <option value="<?php echo str_pad($d,2,'0',STR_PAD_LEFT);?>"><?php echo str_pad($d,2,'0',STR_PAD_LEFT);?></option>
                            <?php
                            }
                        }
                        ?>
                    </select>

                    <input type="submit" name="updatedob" value="" class="update" />
                    <input type="submit" name="submm" class="cancel" value="" onclick="document.href='studentInfo.php'" />
                </form>
            <?php

            }else{
                echo date('d/m/Y',strtotime($dob));
            }
            ?></td>
        <td><?php if(!isset($_POST['submit-5']))
            {
                ?>
                <form action="" method="post">
                    <div id="btn">
                        <input type="hidden" name="dateob" value="<?php echo $dob; ?>" />
                        <input type="submit" name="submit-5" class="edit" value="" />
                    </div>
                </form>
            <?php
            }else{
                ?>

            <?php
            }
            ?></td>
    </tr>
    <tr>
        <td id="col">Email: </td>
        <td id="col2"><?php
            if(isset($_POST['submit-email']))
            {
                $email=$_POST['email'];
                ?>
                <form action="" method="post">
                    <input type="text" name="newemail" value="<?php echo $email; ?>" />
                    <input type="hidden" name="oldemail" value="<?php echo $email; ?>" />
                    <input type="submit" name="updateemail" value="" class="update" />
                    <input type="submit" name="submm" class="cancel" value="" onclick="document.href='studentInfo.php'" />
                </form>
            <?php

            }else{
                echo $email;
            }
            ?></td>
        <td><?php if(!isset($_POST['submit-email']))
            {
                ?>
                <form action="" method="post">
                    <div id="btn">
                        <input type="hidden" name="email" value="<?php echo $email; ?>" />
                        <input type="submit" name="submit-email" class="edit" value="" />
                    </div>
                </form>
            <?php
            }else{
                ?>

            <?php
            }
            ?></td>
    </tr>
    <tr>
        <td id="col">Address line1:</td>
        <td id="col2"><?php
            if(isset($_POST['submit-6']))
            {
                $address1=$_POST['address1'];
                ?>
                <form action="" method="post">
                    <input type="text" name="newaddress1" value="<?php echo $address1; ?>" />
                    <input type="hidden" name="oldaddress1" value="<?php echo $address1; ?>" />
                    <input type="submit" name="updateaddress1" value="" class="update" />
                    <input type="submit" name="submm" class="cancel" value="" onclick="document.href='studentInfo.php'" />
                </form>
            <?php

            }else{
                echo $address;
            }
            ?></td>
        <td><?php if(!isset($_POST['submit-6']))
            {
                ?>
                <form action="" method="post">
                    <div id="btn">
                        <input type="hidden" name="address1" value="<?php echo $address; ?>" />
                        <input type="submit" name="submit-6" class="edit" value="" />
                    </div>
                </form>
            <?php
            }else{
                ?>

            <?php
            }
            ?></td>
    </tr>
    <tr>
        <td id="col">City:</td>
        <td id="col2"><?php
            if(isset($_POST['submit-7']))
            {
                $city=$_POST['city'];
                ?>
                <form action="" method="post">
                    <input type="text" name="newcity" value="<?php echo $city; ?>" />
                    <input type="hidden" name="oldcity" value="<?php echo $city; ?>" />
                    <input type="submit" name="updatecity" value="" class="update" />
                    <input type="submit" name="submm" class="cancel" value="" onclick="document.href='studentInfo.php'" />
                </form>
            <?php

            }else{
                echo $city;
            }
            ?></td>
        <td><?php if(!isset($_POST['submit-7']))
            {
                ?>
                <form action="" method="post">
                    <div id="btn">
                        <input type="hidden" name="city" value="<?php echo $city; ?>" />
                        <input type="submit" name="submit-7" class="edit" value="" />
                    </div>
                </form>
            <?php
            }else{
                ?>

            <?php
            }
            ?></td>
    </tr>
    <tr>
        <td id="col">PostCode:</td>
        <td id="col2">
            <?php
            if(isset($_POST['PoCode']))
            {

                $postcode=$_POST['postcode'];
                ?>
                <form action="" method="post">
                    <input type="text" name="postcodes" value="<?php echo $postcode; ?>" />
                    <input type="hidden" name="oldrepostcode" value="<?php echo $postcode; ?>" />
                    <input type="submit" name="postcodeupdate" value="" class="update" />
                    <input type="submit" name="submm" class="cancel" value="" onclick="document.href='studentInfo.php'" />
                </form>
            <?php


            }
            else{
                echo $postcode;
            }
            ?>

        </td>
        <td>
            <?php if(!isset($_POST['PoCode']))
            {
                ?>
                <form action="" method="post">
                    <div id="btn">
                        <input type="hidden" name="postcode" value="<?php echo $postcode; ?>" />
                        <input type="submit" name="PoCode" class="edit" value="" />
                    </div>
                </form>
            <?php
            }else{
                ?>

            <?php
            }
            ?>
        </td>
    </tr>
    <tr>
        <td id="col">Country:</td>
        <td id="col2"><?php
            if(isset($_POST['submit-8']))
            {
                $country=$_POST['country'];
                ?>
                <form action="" method="post">
                    <select name="newcountry">
                        <option value="<?php echo $country; ?>"><?php echo $country; ?></option>
                        <?php
                        $q="SELECT * FROM country where name !='$country' order by name";
                        $r=mysql_query($q) or die(mysql_error());
                        while($cont=mysql_fetch_array($r))
                        {
                            ?>
                            <option value="<?php echo $cont['name']; ?>"><?php echo $cont['name']; ?></option>
                        <?php
                        }
                        ?>
                    </select>

                    <input type="submit" name="updatecountry" value="" class="update" />
                    <input type="submit" name="submm" class="cancel" value="" onclick="document.href='studentInfo.php'" />
                </form>
            <?php

            }else{
                echo $country;
            }
            ?></td>
        <td><?php if(!isset($_POST['submit-8']))
            {
                ?>
                <form action="" method="post">
                    <div id="btn">
                        <input type="hidden" name="country" value="<?php echo $country; ?>" />
                        <input type="submit" name="submit-8" class="edit" value="" />
                    </div>
                </form>
            <?php
            }else{
                ?>

            <?php
            }
            ?></td>
    </tr>
    <tr>
        <td id="col">Phone:</td>
        <td id="col2"><?php
            if(isset($_POST['submit-9']))
            {
                $phone=$_POST['phone'];
                ?>
                <form action="" method="post">
                    <input type="text" name="phone" value="<?php echo $phone; ?>" />

                    <input type="submit" name="updatephone" value="" class="update" />
                    <input type="submit" name="submm" class="cancel" value="" onclick="document.href='studentInfo.php'" />
                </form>
            <?php

            }else{
                echo $phone;
            }
            ?></td>
        <td><?php if(!isset($_POST['submit-9']))
            {
                ?>
                <form action="" method="post">
                    <div id="btn">
                        <input type="hidden" name="phone" value="<?php echo $phone; ?>" />
                        <input type="submit" name="submit-9" class="edit" value="" />
                    </div>
                </form>
            <?php
            }else{
                ?>

            <?php
            }
            ?></td>
    </tr>
    <tr>
        <td id="col">Mobile:</td>
        <td id="col2"><?php
            if(isset($_POST['submit-10']))
            {
                $mobile=$_POST['mobile'];
                ?>
                <form action="" method="post">
                    <input type="text" name="mobile" value="<?php echo $mobile; ?>" />

                    <input type="submit" name="updatemobile" value="" class="update" />
                    <input type="submit" name="submm" class="cancel" value="" onclick="document.href='studentInfo.php'" />
                </form>
            <?php

            }else{
                echo $mobile;
            }
            ?></td>
        <td><?php if(!isset($_POST['submit-10']))
            {
                ?>
                <form action="" method="post">
                    <div id="btn">
                        <input type="hidden" name="mobile" value="<?php echo $mobile; ?>" />
                        <input type="submit" name="submit-10" class="edit" value="" />
                    </div>
                </form>
            <?php
            }else{
                ?>

            <?php
            }
            ?></td>
    </tr>
    <tr>
        <td id="col">Status:</td>
        <td id="col2">


            <?php


            if($studentstatus==1)
            {
                echo "Active";
            }
            elseif($studentstatus==2)
            {
                echo "InActive";
            }elseif($studentstatus==3)
            {
                echo "Suspended";
            }elseif($studentstatus==4)
            {
                echo "cancel";
            }

            ?></td>



    </tr>
    </table>

    </ul>

    </div>

    <div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="ui-tabs-9"><ul class="thumbs">
    <table width="600" border="0" id="personnaldetails" class="tablestyle">
    <tr>
        <td id="col1">Job Title:</td>
        <td id="col2"><?php
            if(isset($_POST['updatejobtitle']))
            {
                $jobtitle=$_POST['jobtitle'];
                ?>
                <form action="" method="post">
                    <input type="text" name="title" value="<?php echo $jobtitle; ?>" />

                    <input type="submit" name="updatetitle" value="" class="update" />
                    <input type="submit" name="submm" class="cancel" value="" onclick="document.href='studentInfo.php'" />
                </form>
            <?php

            }else{
                echo $jobtitle;
            }
            ?></td>
        <td><?php if(!isset($_POST['updatejobtitle']))
            {
                ?>
                <form action="studentInfo.php?Id=<?php echo $id;?>#ui-tabs-9" method="post">
                    <div id="btn">
                        <input type="hidden" name="jobtitle" value="<?php echo $jobtitle; ?>" />
                        <input type="submit" name="updatejobtitle" class="edit" value="" />
                    </div>
                </form>
            <?php
            }else{
                ?>

            <?php
            }
            ?></td>
    </tr>
    <tr>
        <td id="col1" style="width:100px;">Company Name:</td>
        <td id="col2" style="width:300px;"><?php
            if(isset($_POST['updatecompany']))
            {
                $companyname=$_POST['companyname'];
                ?>
                <form action="" method="post">
                    <input type="text" name="companyname" value="<?php echo $companyname; ?>" />

                    <input type="submit" name="updatecomp" value="" class="update" />
                    <input type="submit" name="submm" class="cancel" value="" onclick="document.href='studentInfo.php'" />
                </form>
            <?php

            }else{
                echo $companyname;
            }
            ?></td>
        <td style="width:50px;"><?php if(!isset($_POST['updatecompany']))
            {
                ?>
                <form action="studentInfo.php?Id=<?php echo $id;?>#ui-tabs-9" method="post">
                    <div id="btn">
                        <input type="hidden" name="companyname" value="<?php echo $companyname; ?>" />
                        <input type="submit" name="updatecompany" class="edit" value="" />
                    </div>
                </form>
            <?php
            }else{
                ?>

            <?php
            }
            ?></td>
    </tr>
    <tr>
        <td id="col1">Address line1:</td>
        <td id="col2"><?php
            if(isset($_POST['updateadd1']))
            {

                ?>
                <form action="" method="post">
                    <input type="text" name="addline1" value="<?php echo $addressline1; ?>" />

                    <input type="submit" name="upadd1" value="" class="update" />
                    <input type="submit" name="submm" class="cancel" value="" onclick="document.href='studentInfo.php'" />
                </form>
            <?php

            }else{
                echo $addressline1;
            }
            ?></td>
        <td><?php if(!isset($_POST['updateadd1']))
            {
                ?>
                <form action="studentInfo.php?Id=<?php echo $id;?>#ui-tabs-9" method="post">
                    <div id="btn">

                        <input type="submit" name="updateadd1" class="edit" value="" />
                    </div>
                </form>
            <?php
            }else{
                ?>

            <?php
            }
            ?></td>
    </tr>
    <tr>
        <td id="col1">Address line2:</td>
        <td id="col2"><?php
            if(isset($_POST['addressline-2']))
            {
                $lname=$_POST['lname'];
                ?>
                <form action="" method="post">
                    <input type="text" name="addressline2" value="<?php echo $addressline2; ?>" />
                    <input type="submit" name="updateaddressline2" value="" class="update" />
                    <input type="submit" name="submm" class="cancel" value="" onclick="document.href='studentInfo.php'" />
                </form>
            <?php

            }else{
                echo $addressline2;
            }
            ?></td>
        <td><?php if(!isset($_POST['addressline-2']))
            {
                ?>
                <form action="studentInfo.php?Id=<?php echo $id;?>#ui-tabs-9" method="post">
                    <div id="btn">
                        <input type="hidden" name="lname" value="<?php echo $lname; ?>" />
                        <input type="submit" name="addressline-2" class="edit" value="" />
                    </div>
                </form>
            <?php
            }else{
                ?>

            <?php
            }
            ?></td>
    </tr>
    <tr>
        <td id="col1">Address line3:</td>
        <td id="col2"><?php
            if(isset($_POST['addressline-3']))
            {
                $lname=$_POST['lname'];
                ?>
                <form action="" method="post">
                    <input type="text" name="addressline3" value="<?php echo $addressline3; ?>" />

                    <input type="submit" name="updateaddressline3" value="" class="update" />
                    <input type="submit" name="submm" class="cancel" value="" onclick="document.href='studentInfo.php'" />
                </form>
            <?php

            }else{
                echo $addressline3;
            }
            ?></td>
        <td><?php if(!isset($_POST['addressline-3']))
            {
                ?>
                <form action="studentInfo.php?Id=<?php echo $id;?>#ui-tabs-9" method="post">
                    <div id="btn">
                        <input type="hidden" name="lname" value="<?php echo $lname; ?>" />
                        <input type="submit" name="addressline-3" class="edit" value="" />
                    </div>
                </form>
            <?php
            }else{
                ?>

            <?php
            }
            ?></td>
    </tr>
    <tr>
        <td id="col1">City:</td>
        <td id="col2"><?php
            if(isset($_POST['e-city']))
            {

                ?>
                <form action="" method="post">
                    <input type="text" name="ecity" value="<?php echo $ecity; ?>" />

                    <input type="submit" name="updatee-City" value="" class="update" />
                    <input type="submit" name="submm" class="cancel" value="" onclick="document.href='studentInfo.php'" />
                </form>
            <?php

            }else{
                echo $ecity;
            }
            ?></td>
        <td><?php if(!isset($_POST['e-city']))
            {
                ?>
                <form action="studentInfo.php?Id=<?php echo $id;?>#ui-tabs-9" method="post">
                    <div id="btn">

                        <input type="submit" name="e-city" class="edit" value="" />

                    </div>
                </form>
            <?php
            }else{
                ?>

            <?php
            }
            ?></td>
    </tr>
    <tr>
        <td id="col1">Post Code: </td>
        <td id="col2"><?php
            if(isset($_POST['e-postcode']))
            {

                ?>
                <form action="" method="post">
                    <input type="text" name="ecode" value="<?php echo $epostcode; ?>" />

                    <input type="submit" name="epostcode" value="" class="update" />
                    <input type="submit" name="submm" class="cancel" value="" onclick="document.href='studentInfo.php'" />
                </form>
            <?php

            }else{
                echo $epostcode;
            }
            ?></td>
        <td><?php if(!isset($_POST['e-postcode']))
            {
                ?>
                <form action="studentInfo.php?Id=<?php echo $id;?>#ui-tabs-9" method="post">
                    <div id="btn">
                        <input type="hidden" name="lname" value="<?php echo $lname; ?>" />
                        <input type="submit" name="e-postcode" class="edit" value="" />
                    </div>
                </form>
            <?php
            }else{
                ?>

            <?php
            }
            ?></td>
    </tr>
    <tr>
        <td id="col1">Country:</td>
        <td id="col2"><?php
            if(isset($_POST['updateECountry']))
            {
                //$lname=$_POST['lname'];
                ?>
                <form action="" method="post">
                    <select name="ecountry">
                        <option value="<?php echo $ecountry; ?>"><?php echo $ecountry; ?></option>
                        <?php
                        $q="SELECT * FROM country where name !='$ecountry' order by name";
                        $r=mysql_query($q) or die(mysql_error());
                        while($cont=mysql_fetch_array($r))
                        {
                            ?>
                            <option value="<?php echo $cont['name']; ?>"><?php echo $cont['name']; ?></option>
                        <?php
                        }
                        ?>
                    </select>

                    <input type="submit" name="updatemecountry" value="" class="update" />
                    <input type="submit" name="submm" class="cancel" value="" onclick="document.href='studentInfo.php'" />
                </form>
            <?php

            }else{
                echo $ecountry;
            }
            ?></td>
        <td><?php if(!isset($_POST['updateECountry']))
            {
                ?>
                <form action="studentInfo.php?Id=<?php echo $id;?>#ui-tabs-9" method="post">
                    <div id="btn">
                        <input type="hidden" name="ecountry" value="<?php echo $ecountry; ?>" />
                        <input type="submit" name="updateECountry" class="edit" value="" />
                    </div>
                </form>
            <?php
            }else{
                ?>

            <?php
            }
            ?></td>
    </tr>

    </table>
    </ul>
    </div>

    <div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="ui-tabs-8"><ul class="thumbs" style="height:300">

            <?php
            $feequery="select * from tbl_fee where rollno='$id'";
            $feeresult=mysql_query($feequery) or die(mysql_error());
            $fetchFee=mysql_fetch_array($feeresult);
            //$totalQuery="select sum(paid) as totalpaid from tbl_fees_install where rollno='$id'";
            $totalQuery="select sum(paid) as paid  from tbl_fees_install where rollno='$id'";
            $totalResult=mysql_query($totalQuery) or die(mysql_error());
            $fetchAmount=mysql_fetch_array($totalResult);
            if(mysql_num_rows($feeresult) > 0)
            {
                ?>


                <div style="margin-bottom: 29px;width:220px;">
                    <div style="margin-bottom: 5px;" ><div style="width: 160px;float: left;font-size:15px;">Total Balance:</div><span style="color:#28166f;font-size:15px;"><?php echo '&euro;'.$fetchFee['fee']; ?></span></div>
                    <div style="margin-bottom: 5px;" ><div style="width: 160px;float: left;font-size:15px;">Total Paid:</div><span style="color:#28166f;font-size:15px;"><?php echo '&euro;'.$fetchAmount['paid']; ?></span></div>
                    <div style="margin-bottom: 5px; border-top:1px solid black;" ><div style="width: 160px;float: left;color:red;font-size:15px;">Due:</div><span style="color:#28166f;font-size:15px;"><?php echo '&euro;'.$ff=$fetchFee['fee']-$fetchAmount['paid']; ?></span></div>

                </div>
            <?php

            }
            ?>

            <table width="860" border="0" class="altrowstable" >
                <tr style="background-color:black;color:#fff">
                    <td width="80">Date</td>
                    <td>Description</td>
                    <td width="100">Payment Type</td>
                    <td width="70">Payable</td>
                    <td width="40">Paid</td>
                </tr>
                <?php
                $paysum="";
                $remains="";
                $totalPaid="";
                $qf="select * from tbl_fees_install where rollno='$id' order by fee_date asc";

                $ref=mysql_query($qf) or die(mysql_error());
                while($row=mysql_fetch_array($ref))
                {
                    list($year,$month,$da)=explode('-',$row['fee_date']);
                    $totalPaid=$totalPaid+$row['paid'];
                    $paysum=$paysum+$row['payble'];
                    ?>
                    <tr>
                        <td><?php echo $da.'/'.$month.'/'.$year;?></td>
                        <td><?php echo $row['des']; ?></td>
                        <td><?php echo $row['bankname']; ?></td>
                        <td><?php echo $row['payble']; ?></td>
                        <td><?php echo $row['paid']; ?></td>
                    </tr>

                <?php
                }
                ?>
            </table>

            <div style="margin-top: 75px;margin-left: 306px;width:220px;">
                <div style="margin-bottom: 5px;" ><div style="width: 160px;float: left;font-size:15px;">Total Payble:</div><span style="color:#28166f;font-size:15px;"><?php echo '&euro;'.$paysum; ?></span></div>
                <div style="margin-bottom: 5px;" ><div style="width: 160px;float: left;font-size:15px;">Total Paid:</div><span style="color:#28166f;font-size:15px;"><?php echo '&euro;'.$totalPaid; ?></span></div>
                <div style="margin-bottom: 5px; border-top:1px solid black;" ><div style="width: 160px;float: left;color:red;font-size:15px;">Due:</div><span style="color:#28166f;font-size:15px;"><?php echo '&euro;'.$tol=$paysum-$totalPaid;?></span></div>

            </div>


        </ul>
    </div>
    <div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="ui-tabs-3"><ul class="thumbs">

            <p><strong><span id="stassignhead">Course Name:</span></strong><span id="studenassignment"><?php echo $resultSEt['courseName']; ?></span></p>



            <p><strong><span id="stassignhead">Total Topics:</span></strong><span id="studenassignment"><?php echo $resultSEt['coursetopic'];?></span></p>
            <?php

            $query="select * from topic where courseId=".$resultSEt['courseId'];
            $result=mysql_query($query) or die(mysql_error());
            if(mysql_num_rows($result) > 0)
            {?>

                <table width="800" border="0" class="table table-bordered" >
                    <thead>
                    <tr>
                        <th>Sr#</th>
                        <th>Title</th>
                        <th>Authorization</th>
                        <th>Feedback</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php
                    $sr="";
                    while($rSet=mysql_fetch_array($result)) {
                        $sr++; ?>
                        <tr>
                            <td><?php echo $sr; ?></td>
                            <td><?php echo $rSet['topicName']; ?></td>
                            <?php
                            // Assignment status 12 is for the assignments that have not given the access details
                            $topicId=$rSet['topicId'];
                            $qq="select * from studentassignment where courseid=".$resultSEt['courseId']." and topicId=".$rSet['topicId']." and rollno='$id'  AND AssignmentStatus != 12 order by SAid desc limit 1";
                            $rr=mysql_query($qq) or die(mysql_error());
                            $row=mysql_fetch_array($rr);
                            $topic=$row['AssignmentName'];
                            ?>
                            <td><?php if($row['AssignmentStatus']==1){
                                    echo "<span class=\"as\">With Student</span>";
                                }elseif($row['AssignmentStatus']==2){
                                    echo "<span class=\"tut\">With Tutor</span>";
                                }elseif($row['AssignmentStatus']==3){
                                    echo "<span class=\"assign\">Completed</span>";
                                }else{echo "<span class=\"notassign\">Not Assigned<span>";}?></td>

                            <td><?php
                                $qeuer="select * from studenresult where assignmentId='$topic' and rollno='$id'";
                                $res=mysql_query($qeuer) or die("error");
                                $fe=mysql_fetch_array($res);
                                if($row['AssignmentStatus']==1)
                                {
                                    //echo "With student";
                                    echo "----------";
                                }elseif($row['AssignmentStatus']==2)
                                {
                                    //echo "With Tutor";
                                    echo "----------";
                                }elseif($row['AssignmentStatus']==3)
                                {
                                    ?>
                                    <!-- <a href="../studentresult/<?php //echo $fe['fullname'];?>">View Result &nbsp;&nbsp;&nbsp; <img src="../images/success.gif" /> </a>-->
                                    <a href="download.php?res=<?php echo $fe['fullname'];?>">View Result&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
                                <?php
                                }else
                                {
                                    ?>
                                    <span>----------</span>
                                <?php
                                }
                                ?></td>
                        </tr>
                    <?php } ?>
                    </tbody>
                </table>
            <?php
            }else{
                echo "No Topic exists";
            }
            ?>
            <?php

            if(isset($_GET['rr']))
            {

                $file="../studentresult/".$_GET['rr']; //file location
                header('Content-Type: application/octet-stream');
                header('Content-Disposition: attachment; filename="'.basename($file).'"');
                header('Content-Length: ' . filesize($file));
                readfile($file);

            }
            ?>

        </ul>



    </div>

    <?php include('student_outbox_email.php'); ?>

    <div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="ui-tabs-31">
    <ul class="thumbs">

    <?php
    if(isset($_POST['addemail'])) {

        if (isset($_FILES['attachment_email']) && $_FILES['attachment_email']['name'] != "") {

            //to upload file
            $name = $_FILES['attachment_email']['name'];

            $temp_name = $_FILES['attachment_email']['tmp_name'];

            $allowed = array('doc', 'docx', 'pdf');

            $type = explode('.', $name);

            $dir = "../email_attachments/";
            $rand = mt_rand();
            $fullername = $rand . $name;

            if (in_array($type[1], $allowed)) {

                if (move_uploaded_file($temp_name, $dir . $fullername)) {

                } else {

                    $_SESSION['sessionMsg'] = "Error! Invalid File Format, Only 'doc, docx, pdf' file supported ";
                    header("location:studentInfo.php?Id=$id#ui-tabs-31");
                    exit();

                }


            }
        }


        $email_message = $_POST['email_message'];
        $subject = $_POST['subject'];
        $idad = $_POST['emailsOfstudents'];
        $query_12 = "SELECT email  FROM programe_co WHERE PCId = " . $idad . " ";
        $resutlt_12 = mysql_query($query_12);
        $fectch_12 = mysql_fetch_array($resutlt_12);

        /**********************************************************************/


        $mail = new PHPMailer;


        $mail->isSMTP();                                      // Set mailer to use SMTP

        $mail->Host = "smtp.gmail.com";  // Specify main and backup server

        $mail->Port = 25;


        $mail->SMTPAuth = true;                               // Enable SMTP authentication

        $mail->Username = $config['smtp_username'];                        // SMTP username

        $mail->Password = $config['smtp_password'];                           // SMTP password

        $mail->SMTPSecure = 'tls';                            // Enable encryption, 'ssl' also accepted


        $mail->From = "bolconline.com";

        $mail->FromName = "Coordinator";

        $mail->addAddress("admissions@bolc.co.uk");  // Add a recipient

        //$mail->addAddress('ellen@example.com');               // Name is optional

        //$mail->addReplyTo('info@example.com', 'Information');

        //$mail->addCC('cc@example.com');

        //$mail->addBCC('bcc@example.com');


        $mail->WordWrap = 50;                                 // Set word wrap to 50 characters

        $mail->isHTML(true);                                  // Set email format to HTML


        $mail->Subject = $subject;
        $file_to_attach = '../email_attachments/';
        if (isset($_FILES['attachment_email']) && $_FILES['attachment_email']['name'] != "") {
            $mail->AddAttachment("../email_attachments/" . $fullername);

        }
        $email_message = str_replace("\r", "<br>", $email_message);
        $email_message = str_replace("\n", "<br>", $email_message);
        $email_message = mysql_real_escape_string($email_message);
        $mail->Body = $email_message;

        if (!$mail->send()) {


            $_SESSION['sessionMsg'] = "Mail could not be sent. Check if you are connected to internet and try again.";

            echo 'Mail could not be sent.';

            echo 'Mailer Error: ' . $mail->ErrorInfo;


        } else {

            $msg = "Your Message has been Sent !";
        }
        /***************************************************************************************************/

        $selectEmailst = "SELECT email FROM student WHERE SId = '" . $id . "' ";
        $selectemail = mysql_query($selectEmailst);
        $ssem = mysql_fetch_array($selectemail);


        $query = "INSERT INTO `emails`(  `student_id`, `coordinator_id`, `student_email`, `coordinator_email`, `message`, `attachment`, `sender`, `email_date`, `subject`) VALUES ( '" . $id . "','" . $idad . "','" . $ssem[0] . "','admissions@bolc.co.uk','" . $email_message . "','" . $fullername . "',0,'" . date("Y-m-d") . "','" . $subject . "')";
        $result = mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id#ui-tabs-31");
        exit();
    } else  if(isset($_GET['edit'])) { ?>
        <form action="" method="post" enctype="multipart/form-data">

            <!--<select name="emailsOfstudents" id="change_id" required="required"  >
				<option value=""></option>
			<?php
            $selectEmail = "SELECT PCId,email, concat_ws(' ',name,fathername) AS full_name FROM programe_co WHERE CoStatus = 1";
            $selectEmail2 = mysql_query($selectEmail) or die(mysql_error());

            while($selectEmail3 = mysql_fetch_array($selectEmail2)) { ?>
				<option value="<?php echo $selectEmail3[0]; ?>" > <?php echo $selectEmail3['full_name']; ?></option>
			<?php } ?>
				</select>-->

            <br /><br />

            <div class="form-group clearfix">
                <label><b>Subject: </b></label>
                <input type="text" name="subject" placeholder="Write email subject here" class="form-control" />
            </div>

            <div class="form-group clearfix">
                <label><b>Message: </b></label>
                <textarea name="email_message" rows="10" id="msgg" cols="92" placeholder= "Write Your Message Here" class="form-control"></textarea>
            </div>

            <div class="form-group">
                <input type="file" name="attachment_email" class="form-control">
            </div>

            <input type="submit" name="addemail" value="Send Email" class="btn btn-success" />
            <!--<input type="submit" name="" class="add" value="Cancel" onclick="document.href='studentInfo.php'" />-->


        </form>
    <?php
    } else { ?>
<a href="studentInfo.php?Id=<?php echo $id;?>&edit#ui-tabs-31" class="btn btn-success" style="color: #fff;">Create Message</a>
    <?php
    }
    $query="SELECT * FROM emails where student_id='$id' AND sender = 1 order by email_id desc";

    $result=mysql_query($query) or die(mysql_error());

    if(mysql_num_rows($result) > 0) { ?>
            <table style="margin-top:20px;" class="tablestyle table table-striped table-bordered table-hover">
            <thead>
                <tr>
                    <th>Sr</th>
                    <th>Date</th>
                    <th>Subject</th>
                    <th>Attachment</th>
                </tr>
            </thead>
            <tbody>
            <?php
            while($rr=mysql_fetch_array($result)) {
                $email_counter++;
                $all=explode(' ',$rr['edittime']);
                $date=$all[0];
                $time=@$all[1];
                $msg="";
                if($rr['role']==1) {
                    $msg="Admin";
                } elseif($rr['role']==2) {
                    $msg=$rr['name']."(Coordinator)";

                }elseif($rr['role']==3) {
                    $msg=$rr['name']."(Tutor)";
                }
                $string=  $rr['subject'] ; ?>
                <tr>

                    <td><a href="#" data-toggle="modal" data-target="#myModal<?php echo $email_counter; ?>w" style="display: block; width: 100%; color: #4B8DF8;">
                            <?php echo $email_counter; ?></a></td>

                    <td><a href="#" data-toggle="modal" data-target="#myModal<?php echo $email_counter; ?>w" style="display: block; width: 100%; color: #4B8DF8;">
                            <?php echo date('d-m-Y', strtotime($rr['email_date'])); ?></a>
                    </td>

                    <td><a href="#" data-toggle="modal" data-target="#myModal<?php echo $email_counter; ?>w" style="display: block; width: 100%; color: #4B8DF8;">
                            wewew<?php echo $string; ?></a>
                    </td>

                    <td><a href="../email_attachments/<?php echo $rr['attachment'] ?>" style="display: block; width: 100%; color: #4B8DF8;">
                            <?php echo  $rr['attachment'];  ?></a>
                    </td>

                </tr>



                <div class="modal fade" id="myModal<?php echo $email_counter; ?>w" tabindex="1" role="dialog" aria-labelledby="myModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title" id="myModalLabel"><?php echo $string; ?></h4>
                            </div>
                            <div class="modal-body">
                                <?php echo  $rr['message']; ?>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                            </div>
                        </div>
                    </div>
                </div>






            <?php } ?>
            </tbody>
        </table>

  <?php } else {
        echo "No Email Exists";
    } ?>

    </ul>
    </div>

    </div>

    </div>

    </div>
    </div>

    </div> <!-- end content  -->

    </div><!-- end wrapper -->





<?php include('../includes/footer-old.php');?>

<?php
$email_counter = 0;
$query = "SELECT * FROM emails where student_id='$id' AND sender = 0 order by email_id desc";
$result=mysql_query($query) or die(mysql_error());
if(mysql_num_rows($result) > 0){
    while($rr=mysql_fetch_array($result)) { $email_counter++ ?>


        <div class="modal fade" id="myModal<?php echo $email_counter; ?>" tabindex="1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel"><?php echo $string; ?></h4>
                    </div>
                    <div class="modal-body">
                        <?php echo  $rr['message']; ?>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    </div>
                </div>
            </div>
        </div>
    <?php }
} ?>