• Call Us: +92-333-7276335
  • - Mail Us: info@shekztech.com

Plot 1177, Sector 31B - Crossing, Karachi, Sindh

Delete operation in Codeigniter 4

Please Login and enroll in this course to view the lesson.

Delete operation in Codeigniter 4, yes you always perform the delete operation in any application because its the part of the CRUD operation.

<div class="container">
 		<div class="row">
 			<div class="col-md-12">
        <?php if (!empty($message) && isset($message)): ?>
          <?php echo $message; ?>
        <?php endif; ?>
        <br>
        <a class="btn btn-success" href="<?php echo site_url('students/newstudent'); ?>">New User</a>
        <h1>All Students</h1>
        <table class="table">
          <th>ID</th>
          <th>Name</th>
          <th>Subject</th>
          <th>Date</th>
          <th>Edit</th>
          <th>Delete</th>
          <?php if(count($students) > 0): ?>
            <?php foreach ($students as $myStudent): ?>
              <tr>
                <td>
                  <?php echo $myStudent['s_id'];?>
                </td>
                <td>
                  <?php echo $myStudent['s_name'];?>
                </td>
                <td>
                  <?php echo $myStudent['s_subject'];?>
                </td>
                <td>
                  <?php echo $myStudent['s_date'];?>
                </td>
                <td>
                  <a class="btn btn-info" href="<?php echo site_url('students/editstudent/'.$myStudent['s_id'])?>">Edit</a>
                </td>
                <td>
                  <a class="btn btn-danger" href="<?php echo site_url('students/delete/'.$myStudent['s_id'])?>">Delete</a>
                </td>
              </tr>
            <?php endforeach; ?>
          <?php endif; ?>
        </table>
      </div>
    </div>
  </div>