PATH:
home2
/
pbkvidya
/
public_html
/
admin
/
Editing: add_documentinfo.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'); ?> <?php if(isset($_POST["btnDocInfoAdd"])) { $upload_dir = "../uploads/"; $fields = ['fileImg', 'fileImg1', 'fileImg2', 'fileImg3', 'fileImg4', 'fileImg5', 'fileImg6', 'fileImg7']; $file_paths = []; foreach ($fields as $field) { if (!empty($_FILES[$field]["name"])) { $filename = basename($_FILES[$field]["name"]); $tempname = $_FILES[$field]["tmp_name"]; $folder = $upload_dir . $filename; if (move_uploaded_file($tempname, $folder)) { $file_paths[] = $folder; } else { $file_paths[] = ""; // failed upload } } else { $file_paths[] = ""; // no file selected } } // Insert into database $sql = mysqli_query($con, "INSERT INTO `tbl_documentinfo` (`affiliation_letter`, `company_renewal`, `noc`, `recognition_cert`, `building_safety`, `fire_safety`, `self_certification`, `water_health_sani`) VALUES ('{$file_paths[0]}', '{$file_paths[1]}', '{$file_paths[2]}', '{$file_paths[3]}', '{$file_paths[4]}', '{$file_paths[5]}', '{$file_paths[6]}', '{$file_paths[7]}')"); if ($sql) { echo "<script>alert('Document Information Uploaded');</script>"; } else { echo "<script>alert(' Insertion Failed!');</script>"; } mysqli_close($con); } ?> <head> <style type="text/css"> textarea{ width: 310px; height: 110px; border-radius: var(--bs-border-radius); } </style> </head> <main id="main" class="main"> <div class="pagetitle"> <!-- <h1>Dashboard</h1> --> <nav> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="index.html">Home</a></li> <li class="breadcrumb-item active">Add Documents and Information</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">Add New Documents and Information</h5></div> <div class="col-lg-5"><h5 class="card-title title-right"><a href="update_documentinfo.php" class="btn btn-secondary">Update Documents and Information</a></h5></div> </div> <div class="row mb-3"> </div> <!-- General Form Elements --> <form name="Formmandatory" method="post" enctype="multipart/form-data" class="pt-20"> <!-- <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">mandatory Title</label> <div class="col-sm-5"> <textarea id="txtBanTitle" name="txtBanTitle" class="textarea1" ></textarea> </div> </div> --> <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">COPIES OF AFFILIATION/UPGRADATION LETTER AND RECENT EXTENSION OF AFFILIATION</label> <div class="col-sm-5"> <input class="form-control" type="file" name="fileImg" id="fileImg" > </div> </div> <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">COPIES OF SOCIETIES/TRUST/COMPANY REGISTRATION/RENEWAL CERTIFICATE</label> <div class="col-sm-5"> <input class="form-control" type="file" name="fileImg1" id="fileImg1" > </div> </div> <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">COPY OF NO OBJECTION CERTIFICATE (NOC) ISSUED, IF APPLICABLE, BY THE STATE GOVT./UT</label> <div class="col-sm-5"> <input class="form-control" type="file" name="fileImg2" id="fileImg2" > </div> </div> <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">COPIES OF RECOGNITION CERTIFICATE UNDER RTE ACT, 2009, AND IT'S RENEWAL IF APPLICABLE</label> <div class="col-sm-5"> <input class="form-control" type="file" name="fileImg3" id="fileImg3" > </div> </div> <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">COPY OF VALID BUILDING SAFETY CERTIFICATE AS PER THE NATIONAL BUILDING CODE</label> <div class="col-sm-5"> <input class="form-control" type="file" name="fileImg4" id="fileImg4" > </div> </div> <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">COPY OF VALID FIRE SAFETY CERTIFICATE ISSUED BY THE COMPETENT AUTHORITY</label> <div class="col-sm-5"> <input class="form-control" type="file" name="fileImg5" id="fileImg5" > </div> </div> <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">COPY OF THE SELF CERTIFICATION SUBMITTED BY THE SCHOOL FOR AFFILIATION/UPGRADATION/EXTENSION OF AFFILIATION*</label> <div class="col-sm-5"> <input class="form-control" type="file" name="fileImg6" id="fileImg6" > </div> </div> <div class="row mb-3"> <label for="inputText" class="col-sm-4 col-form-label">COPIES OF VALID WATER, HEALTH AND SANITATION CERTIFICATES</label> <div class="col-sm-5"> <input class="form-control" type="file" name="fileImg7" id="fileImg7" > </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="btnDocInfoAdd" id="btnDocInfoAdd" value="Submit"> </div> </div> </form><!-- End General Form Elements --> </div> </div> </div> <div class="col-lg-1"> </div> </div> </section> </main><!-- End #main --> <?php include_once('footer.php'); ?>
SAVE
CANCEL