  


</head>
<style type="text/css">
<!--
.style1 {font-style: italic}
.style2 {font-style: italic}
-->
</style>
<body>
<div class="page-container">

	
	<div class="page-content">
		<div class="container">
			<div class="page-toolbar">
				<div class="page-toolbar-block">
					<div class="page-toolbar-title">Import Excel File</div>
					<div class="page-toolbar-subtitle"></div>
				</div>
				<div class="page-toolbar-block pull-right">
					<div class="widget-info widget-from">
						
					
						
					</div>
				</div>
				
			</div>
			<div class="row">
				<div class="col-md-12">
					<div class="block">
						<div class="block-content">
							<h2><strong></strong> <a href="#" class="glyphicon glyphicon-question-sign" data-container="body" data-toggle="popover" data-placement="right" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." data-original-title="" title=""></a></h2>
							<table width="699" border="0" align="center">

   <form enctype="multipart/form-data" method="post" role="form">
    <div class="form-group">
        <label for="exampleInputFile">File Upload</label>
        <input type="file" name="file" id="file" size="150">
        <p class="help-block">Only Excel File Import.</p>
    </div>
    <button type="submit" class="btn btn-default" name="Import" value="Import">Upload</button>
</form>
<?php 
if(isset($_POST["Import"]))
{
    //First we need to make a connection with the database
      include 'dbc.php';
    echo $filename=$_FILES["file"]["tmp_name"];
    if($_FILES["file"]["size"] > 0)
    {
        $file = fopen($filename, "r");
        //$sql_data = "SELECT * FROM prod_list_1 ";
        while (($emapData = fgetcsv($file, 10000, ",")) !== FALSE)
        {
            //print_r($emapData);
            //exit();
            $sql = "INSERT into admission(date,std_rollno,std_name,father_name,allied_code,monthly_fee,class_name,bal,father_nic,cell_1,code,cell_2,user_id,camp) values ('$emapData[0]','$emapData[1]','$emapData[2]','$emapData[3]','$emapData[4]','$emapData[5]','$emapData[6]','$emapData[7]','$emapData[8]','$emapData[9]','$emapData[10]','$emapData[11]','$emapData[12]','$emapData[13]')";
            mysql_query($sql);
        }
        fclose($file);
        echo 'CSV File has been successfully Imported';
        header('Location: admission_form_raheem.php');
    }
    else
        echo 'Invalid File:Please Upload CSV File';
}

?>

   