Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8694463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:47:44+00:00 2026-06-13T00:47:44+00:00

Below is a php code i made in a non codeigniter code work. It

  • 0

Below is a php code i made in a non codeigniter code work. It is a check all and uncheck all delete function. i’m not sure where to put this if it’s in the control model or view? can anyone please help me.

<?php

/*Check Box Commands*/
$id=$row_notification['user_id'];

if(isset($_POST['Delete'])) {
$checkbox = $_POST['checkbox'];
mysql_select_db($database_connection_ched, $connection_ched);
$id=$row_notification['user_id'];

for($i=0;$i<count($checkbox);$i++)
  {
$delete = "DELETE FROM tb_user WHERE user_id=$checkbox[$i]";
mysql_query($delete,$connection_ched);

}
$result2 = mysql_query($delete);

if($result2)
{
echo "[removed]alert ('Successfully Deleted');[removed]"; 
echo "<meta http-equiv=\"refresh\" content=\"0;URL=notification.php?\">"; }

}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:47:46+00:00Added an answer on June 13, 2026 at 12:47 am

    You should not be using “meta refresh” for redirection.

    Use PHP’s header function:

    http://www.php.net/manual/en/function.header.php

    You should put that code in your Controller.

    Example:

    class MyController extends CI_Controller {
        public function index() {
            /*Check Box Commands*/
            $id=$row_notification['user_id'];
    
            if(isset($_POST['Delete'])) {
            $checkbox = $_POST['checkbox'];
    
            // use CodeIgniter models when communicating with your database
            // and when manipulating any database data
            // more on: http://codeigniter.com/user_guide/general/models.html
            mysql_select_db($database_connection_ched, $connection_ched);
            $id=$row_notification['user_id'];
    
            for($i=0;$i<count($checkbox);$i++) {
                $delete = "DELETE FROM tb_user WHERE user_id=$checkbox[$i]";
                mysql_query($delete,$connection_ched);
            }
    
            $result2 = mysql_query($delete);
    
            if($result2) {
                // as I pointed out, don't use "meta refresh" for redirection
                // and dont use alert for notifying anyone-anywhere
                echo "[removed]alert ('Successfully Deleted');[removed]";
                echo "<meta http-equiv=\"refresh\" content=\"0;URL=notification.php?\">"; }
            }
        }
    }
    

    And small piece of advice:

    You do not have to notify anyone via JavaScript’s alert function when something is deleted, inserted, altered or anything alike. Alert is a bit anoying.

    Also, checkout these links:

    • http://ellislab.com/codeigniter/user_guide/general/models.html
    • http://ellislab.com/codeigniter/user_guide/general/views.html
    • http://ellislab.com/codeigniter/user_guide/general/controllers.html

    That should help you get a more clearer picture how MVC works, and how CodeIgniter works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i write below code for sending id to another php file function selectCheckBox(k) {
Ok I have made my custom post type and they work fine(code shown below).
Below is a watermark function I made for my php photo upload script. I
How do I convert the below PHP code to VB.NET? <?php $X_HOST =foo.com; $X_URL
When I use a conditional statement targeting IE6 and below with some PHP code
Below is my code for a simple form in the create_session.php page. I am
The code below is written in php: $user = addslashes($_POST['user']); $pwd = addslashes($_POST['pwd']); $query
Below is a snippet of code that is trying to post to a PHP
The code below gets the username/password and runs it thru the backend.php script. <?php
I am using below code to upload excel and INSERT in mysql in php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.