<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" name="viewport" content="width-device-width, initial-scale=1"/>
		<link rel="stylesheet" type="text/css" href="cssAddEdit/bootstrap.css"/>
	</head>
<body>
	<nav class="navbar navbar-default">
		<div class="container-fluid">
			<a class="navbar-brand" href="https://sourcecodester.com">Sourcecodester</a>		</div>
	</nav>
	<div class="col-md-3"></div>
	<div class="col-md-6 well">
		<h3 class="text-primary">School Information Add Edit Module</h3>
		<hr style="border-top:1px dotted #ccc;"/>
		<button type="button" class="btn btn-success" data-toggle="modal" data-target="#form_modal"><span class="glyphicon glyphicon-plus"></span> Add user</button>
		<br /><br />
		<table class="table table-bordered">
			<thead class="alert-success">
				<tr>
					<th>Sl No </th>
					<th>Subject</th>
					<th>Upload Date </th>
					<th>File Name </th>
					<th>Download File Name </th>
					<th>Action</th>
				</tr>
			</thead>
			<tbody style="background-color:#fff;">
				<?php
					require 'db_connection.php';
					$conn = OpenCon();
					$query = mysqli_query($conn, "SELECT * FROM `school_info`") or die(mysqli_error());
					while($fetch = mysqli_fetch_array($query)){
				?>
				<tr>
					<td><?php echo $fetch['sl_no']?></td>
					<td><?php echo $fetch['subject']?></td>
					<td><?php echo $fetch['Upload_date']?></td>
					<td><?php echo $fetch['Filename']?></td>
					<td><a href='<?php echo $fetch['Location']?>' target='_blank'>Download</a></td>
					<td><button class="btn btn-warning" data-toggle="modal" type="button" data-target="#update_modal<?php echo $fetch['sl_no']?>"><span class="glyphicon glyphicon-edit"></span> Edit</button></td>
				</tr>
				<?php
					
					include 'update_user.php';
					
					}
				?>
			</tbody>
		</table>
	</div>
	<div class="modal fade" id="form_modal" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<form method="POST" action="save_user.php" enctype="multipart/form-data">
					<div class="modal-header">
						<h3 class="modal-title">Add User</h3>
					</div>
					<div class="modal-body">
						<div class="col-md-2"></div>
						<div class="col-md-8">
						<!--------------------------------------------------->
							<!--div class="form-group">
								<label>Firstname</label>
								<input type="text" name="firstname" class="form-control" required="required"/>
							</div-->
						<!--------------------------------------------------->	
							<div class="form-group">
								<label>Upload Date</label>
								<input type="date" id="country" name="dtpUploadDate" placeholder="DD/MM/YYY" max=""="2022-12-31" >
							</div>
						<!--------------------------------------------------->
							<div class="form-group">
								<label>Suject</label>
								<input type="text" name="txtSubject" class="form-control" required="required" />
							</div>
						<!--------------------------------------------------->
						<!--------------------------------------------------->													
							<div class="form-group">
								<label>File name</label>
								<input type="file" name="file">
							</div>
						<!--------------------------------------------------->							
						</div>
					</div>
					<div style="clear:both;"></div>
					<div class="modal-footer">
						<button name="save" class="btn btn-primary"><span class="glyphicon glyphicon-save"></span> Save</button>
						<button class="btn btn-danger" type="button" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span> Close</button>
					</div>
					</div>
				</form>
	  </div>
</div>
	</div>	
<script src="jsAddEdit/jquery-3.2.1.min.js"></script>	
<script src="jsAddEdit/bootstrap.js"></script>	
</body>	
</html>