Mini Shell
<?php
require_once("../config.php");
require_once("function-file.php");
require_once("function-menu.php");
cookiecheck();
$team_id=$_GET['team_id'];
$datas=$conn->prepare("select * from our_interns where team_id='$team_id'");
$datas->execute();$result=$datas->fetch();
if(isset($_POST['save'])){
if(!empty($_FILES['team_img']['name'])){
//Upload Image
$name=$_FILES['team_img']['name'];
$team_img=str_replace(" ","_",$name);
$tmp_name=$_FILES['team_img']['tmp_name'];
$target_path="img/team/";
$target_path=$target_path.basename($team_img);
move_uploaded_file($_FILES['team_img']['tmp_name'],$target_path);
//--
}
else{$team_img=$result['team_img'];}
$team_name=$_POST['team_name'];
$team_position=$_POST['team_position'];
$cate=$_POST['cate'];
$description=$_POST['description'];
$conn->exec("UPDATE our_interns SET team_name='$team_name',team_position='$team_position',team_img='$team_img',cate='$cate',description='$description' where team_id='$team_id'");
header("location:our-interns.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Edit Academic Member</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<?php cssfile();?>
</head>
<body class="hold-transition skin-blue layout-top-nav">
<!-- Site wrapper -->
<div class="wrapper">
<?php headermenu();?>
<!-- =============================================== -->
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<!-- Main content -->
<section class="content">
<!-- Default box -->
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Edit Academic Member</h3>
<div class="box-tools pull-right">
<a href="our-interns.php" class="btn btn-info btn-sm" ><i class="fa fa-angle-double-left"></i> Back</a>
</div>
</div>
<div class="box-body">
<form action="#" method="post" role="form" class="form-horizontal" enctype="multipart/form-data">
<div class="form-group">
<div class="col-sm-4"><label>Role:</label><br>
<select name="cate" class="form-control" >
<option value="1" <?php if($result['cate']==1)echo"selected"; ?>>Advisors</option>
<option value="2" <?php if($result['cate']==2)echo"selected"; ?>>Content Specialist</option>
<option value="3" <?php if($result['cate']==3)echo"selected"; ?>>Teachers and Lecturers</option>
</select></div>
<div class="col-sm-4"><label>Name</label><input name="team_name" class="form-control" placeholder="Enter Name" value="<?php echo $result['team_name']; ?>"></div>
<div class="col-sm-4"><label>Position</label>
<input name="team_position" class="form-control" placeholder="Enter Position" value="<?php echo $result['team_position']; ?>"></div>
</div>
<div class="form-group">
<div class="col-sm-8"><label>Description</label>
<textarea name="description" class="form-control" placeholder="Description..."><?php echo $result['description']; ?></textarea></div>
<div class="col-sm-4"><label>Image:</label><br>
<input type="file" id="file" name="team_img" type="file" class="form-control" accept="image/*" onchange="loadFile(event)"></div>
</div>
<div class="form-group">
<div class="col-sm-8"></div>
<div class="col-sm-4"><img src="img/team/<?php echo $result['team_img'];?>" id="output" class="img-responsive img-thumbnail"/></div>
</div>
<div class="form-group">
<div class="col-sm-12" align="right">
<button type="reset" class="btn btn-default" rows="4">Reset</button>
<button type="submit" name="save" class="btn btn-success" >Save</button></div>
</div>
</form>
</div><!-- /.box-body -->
</div><!-- /.box -->
</section><!-- /.content -->
</div></div><!-- /.content-wrapper -->
<?php footer();?>
</div><!-- ./wrapper -->
<?php jsfile();ratenum();?>
<script>
var loadFile = function(event) {
var output = document.getElementById('output');
output.src = URL.createObjectURL(event.target.files[0]);
};
</script>
</body>
</html>
Zerion Mini Shell 1.0