EVOLUTION-NINJA
Edit File: institution_registration.php
<?php echo view('includes/admin_header.php') ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Add Institution</title> <!-- Include Bootstrap CSS if needed --> <!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> --> </head> <body> <div class="content-wrapper"> <div class="col-sm-12 col-md-offset-1 col-md-10 col-lg-offset-1 col-lg-10" style="margin-left: 12%"> <section class="content-header"> <br> <h1 style="padding-bottom:10px;border-bottom:2px dashed #468662;margin-bottom:20px; font-weight: bold;">ADD INSTITUTION</h1> <a href="javascript:history.back()" class="btn btn-primary" style="float:right;margin-top:80px; margin-right:15px;">Back</a> </section> <br> <br> <!-- Main content --> <section class="content enrolled_details" style="margin-left: 15%; width: 70%;"> <div class="row"> <div class="col-sm-6"> <form id="myForm" action="<?= site_url('institution-registration-submit') ?>" method="post"> <div class="form-group"> <label for="institution_name">Institution Name</label> <input type="text" class="form-control" name="institution_name" id="institution_name" placeholder="Enter Institution Name" required> </div> <div class="form-group"> <label for="address">Address</label> <input type="text" class="form-control" name="address" id="address" placeholder="Enter Address" required> </div> <div class="form-group"> <label for="email">Email</label> <input type="email" class="form-control" name="email" id="email" placeholder="Enter Email" required> </div> <div class="form-group"> <label for="phone">Phone</label> <input type="tel" class="form-control" name="inst_phone" id="phone" placeholder="Enter Phone" required> </div> <div class="form-group"> <label for="contact_person_details">Contact Person Details</label> <input type="text" class="form-control" name="contact_person_details" id="contact_person_details" placeholder="Enter Contact Person Details"> </div> <button type="submit" class="btn btn-primary">Submit</button> </form> </div> </div> </section> </div> </div> <footer class="main-footer main-footer1" style="background-color: #468662;"> <div class="pull-right hidden-xs"> <strong>Copyright © 2024 AMCAD</strong> All rights reserved. </footer> <style> .main-footer1{ /*background-color: #468662;*/ color: #fff; border-top: none; } </style> <!-- Include jQuery --> <script src="https://code.jquery.com/jquery-3.6.4.min.js"></script> <script> $(document).ready(function() { $("#myForm").submit(function(e) { e.preventDefault(); // Serialize the form data var formData = $(this).serialize(); // Make an AJAX request $.ajax({ type: "POST", url: "<?= site_url('institution-registration') ?>", data: formData, dataType: "json", success: function(response) { if (response.success) { // Redirect to the institution_details page window.location.href = "<?= site_url('show_details/') ?>" + response.id; } else { // Display an error message alert(response.message); } }, error: function() { alert("An error occurred while processing your request."); } }); }); }); </script> <!-- Include Bootstrap JS if needed --> <!-- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> --> </body> </html>