PATH:
home2
/
pbkvidya
/
public_html
/
admin
/
Editing: update_infrastructure.php
<?php include_once('connect.php'); session_start(); // Check if the user is logged in if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) { echo "<script type='text/javascript'>window.location.href = 'index.php';</script>"; // Redirect to login page exit(); } include_once('head.php'); ?> <head> <style type="text/css"> textarea{ width: 270px; height: 110px; border-radius: var(--bs-border-radius); } </style> </head> <?php if(isset($_POST["btnTenth"])) { $hid=$_POST['txtHid']; $area=$_POST['txtArea']; $classno=$_POST['txtClassno']; $classsize=$_POST['txtClasssize']; $labno=$_POST['txtLabno']; $labsize=$_POST['txtLabsize']; $internet=$_POST['selInternet']; $gtoilet=$_POST['txtGToilet']; $btoilet=$_POST['txtBToilet']; $youtube=$_POST['txtYoutube']; $filename = $_FILES["fileImg"]["name"]; $tempname = $_FILES["fileImg"]["tmp_name"]; if($filename==""){ $folder=$_POST['imagepath']; } else { $folder ="../uploads/".$filename; } $oldfile=$_POST['imagepath']; $newfile ="../uploads/".$filename; $insert1 = mysqli_query($con,"UPDATE `tbl_infrastructure` SET `campus_area`='$area',`classroom_no`='$classno',`classroom_size`='$classsize',`lab_no`='$labno',`lab_size`='$labsize',`internet_facility`='$internet',`girss_toiletno`='$gtoilet',`boys_toiletno`='$btoilet',`youtube_video`='$youtube',`teacher_list`='$folder' WHERE infrastructure_id=$hid"); if($insert1) { if($filename!=""){ $fold=move_uploaded_file($tempname, $folder); if($oldfile!=$newfile){ unlink($oldfile); } } echo "<script>alert('School Infrastructure Updated');</script>"; } else{ echo "<script>alert('Updation Failed!');</script>"; } } ?> <main id="main" class="main"> <div class="pagetitle"> <nav> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="index.html">Home</a></li> <li class="breadcrumb-item active">Update School Infrastructure</li> </ol> </nav> </div><!-- End Page Title --> <section class="section"> <div class="row"> <div class="col-lg-1"> </div> <div class="col-lg-10"> <div class="card"> <div class="card-body"> <div class="row mb-3 bord-bottom"> <div class="col-lg-5 "><h5 class="card-title">Update School Infrastructure</h5></div> <div class="col-lg-5"><h5 class="card-title"> <!-- <a href="view_academicsresult.php" class="btn btn-secondary">View School Infrastructure</a> --> </h5> </div> </div> <?php $selres = mysqli_query($con,"SELECT * FROM tbl_infrastructure"); while($rowres = mysqli_fetch_array($selres)) { ?> <!-- General Form Elements --> <form name="FormTenth" method="post" enctype="multipart/form-data" class="pt-20"> <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">TOTAL CAMPUS AREA OF THE SCHOOL (IN SQUARE MTR)</label> <div class="col-sm-5"> <input type="text" id="txtHid" name="txtHid" class="form-control" value="<?php echo $rowres['infrastructure_id']; ?>" hidden> <input type="text" id="txtArea" name="txtArea" class="form-control" value="<?php echo $rowres['campus_area']; ?>"> </div> </div> <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">NO. AND SIZE OF THE CLASS ROOMS (IN SQ MTR)</label> <div class="col-sm-5"> <input type="text" id="txtClassno" name="txtClassno" class="form-control" value="<?php echo $rowres['classroom_no']; ?>"> <input type="text" id="txtClasssize" name="txtClasssize" class="form-control" value="<?php echo $rowres['classroom_size']; ?>"> </div> </div> <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">NO. AND SIZE OF LABORATORIES INCLUDING COMPUTER LABS (IN SQ MTR)</label> <div class="col-sm-5"> <input type="text" id="txtLabno" name="txtLabno" class="form-control" value="<?php echo $rowres['lab_no']; ?>"> <input type="text" id="txtLabsize" name="txtLabsize" class="form-control" value="<?php echo $rowres['lab_size']; ?>"> </div> </div> <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">INTERNET FACILITY</label> <div class="col-sm-5"> <input type="text" id="selInternet" name="selInternet" class="form-control" value="<?php echo $rowres['internet_facility']; ?>"> </div> </div> <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">NO. OF GIRLS TOILETS</label> <div class="col-sm-5"> <input type="text" id="txtGToilet" name="txtGToilet" class="form-control" value="<?php echo $rowres['girss_toiletno']; ?>"> </div> </div> <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">NO. OF BOYS TOILETS</label> <div class="col-sm-5"> <input type="text" id="txtBToilet" name="txtBToilet" class="form-control" value="<?php echo $rowres['boys_toiletno']; ?>"> </div> </div> <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">LINK OF YOUTUBE VIDEO OF THE INSPECTION OF SCHOOL COVERING THE INFRASTRUCTURE OF THE SCHOOL</label> <div class="col-sm-5"> <input type="text" id="txtYoutube" name="txtYoutube" class="form-control" value="<?php echo $rowres['youtube_video']; ?>"> </div> </div> <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">UPLOAD TEACHER'S LIST</label> <div class="col-sm-5"> <input type="text" id="image_u" name="imagepath" class="form-control" value="<?php echo $rowres['teacher_list']; ?>" hidden> <label><?php echo $rowres['teacher_list']; ?></label><br> <input class="form-control" type="file" name="fileImg" id="fileImg" > </div> </div> <div class="row mb-3 pt-20"> <label class="col-sm-4 col-form-label"></label> <div class="col-sm-5 "> <input type="submit" class="btn btn-primary btn-center" name="btnTenth" id="btnTenth" value="Submit"> </div> </div> </form><!-- End General Form Elements --> <?php } ?> </div> </div> </div> <div class="col-lg-1"> </div> </div> </section> </main><!-- End #main --> <?php include_once('footer.php'); ?>
SAVE
CANCEL