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 6182261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:10:08+00:00 2026-05-24T01:10:08+00:00

Im new to php..I had used GridView control in asp.net for Listing records. Now

  • 0

Im new to php..I had used GridView control in asp.net for Listing records.

Now I want to use a control in php to list the records with checkbox options to select them for deletion and also page enabled. Can anyone guide a beginner on how to do this?

Thanks in advance.

  • 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-05-24T01:10:09+00:00Added an answer on May 24, 2026 at 1:10 am

    Your idea consists of two things; a table and a php-file that processes the input from the table.

    File: table.php

    <form method="post" action="process.php">
       <table>
          <thead> 
             <tr>
               <th>Title</th>
               <th>Activate</th>
               <th>Delete</th>
             </tr>
          </thead>
          <?php foreach( $records as $record ): ?>
             <tr>
                <td><?php echo $record['title']; ?></td>
                <td><input type="checkbox" name="activate_ids[]" value="<?php echo $record['id']; ?>" /></td>
                <td><input type="checkbox" name="delete_ids[]" value="<?php echo $record['id']; ?>" /></td>
             </tr>
          <?php endforeach; ?>
        </table>
     </form>
    

    File: process.php

    <?php
    
        //Gather the $_POST
        $activate_ids = $_POST['activate_ids'];
        $delete_ids = $_POST['delete_ids'];
    
        //Let's make sure we only get ints
        for($i = 0; $i < count($activate_ids); $i++)$activate_ids[$i] = intval($activated_ids[$i]);        
        for($i = 0; $i < count($delete_ids); $i++)$delete_ids[$i] = intval($delete_ids[$i]);
    
        //Get the ids
        $activate_ids_string = implode(',', $activate_ids);
        $delete_ids_string = implode(',', $delete_ids);
    
        //Make sure we don't have '' as a parameter for SQL
        if( $activate_ids_string == '' ) $activate_ids_string = 0
        if( $delete_ids_string == '' ) $delete_ids_string = 0;
    
        //UPDATE the table
        $sql_activate = 'UPDATE Records SET active=1 WHERE id IN (' . $activate_ids_string . ')';
        $sql_delete = 'DELETE FROM Records WHERE id IN (' . $delete_ids_string . ')';
    
        //Execute the queries and get the # of affected rows
        $aff_rows_activate = mysql_num_rows(mysql_query($sql_activate));
        $aff_rows_delete = mysql_num_rows(mysql_query($sql_delete));
    
        //Last but not least, output how it went for both queries
        if( $aff_rows_activate === 1 ) echo 'Activated one record.';
        else echo 'Activated ' , $aff_rows_activate, ' records.';
        if( $aff_rows_delete === 1 ) echo 'Deleted one record.';
        else echo 'Deleted ' , $aff_rows_activate, ' records.';
    
    ?>
    

    I haven’t had a chance to try out the code above, so there might still be a couple of syntax errors in it – however, you should be able to get an idea of what you need to do to achieve the results that you want.

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

Sidebar

Related Questions

Has anyone ever modified the post-new.php file in their WordPress installation? I want to
Until now, most of my PHP development had been done on a Mac in
Tech used: MySQL 5.1 and PHP 5.3 I am just designing a new database
sorry, I have another problem now. I'm using a new php form method than
I have used PHP for awhile now and have used it well with CodeIgniter,
I am new to .net and I usually had a common file which was
I am new to Cake PHP, in regular PHP I had a index.php and
I am new to Cake PHP and I had a website with regular PHP
Basically i am quite new to PHP and recently i have had heard quite
I am new with Plesk, I used cPlanel whole this time, and never had

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.