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

  • Home
  • SEARCH
  • 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 6807399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:49:40+00:00 2026-05-26T19:49:40+00:00

I wrote the code in PHP like this and I need to delete the

  • 0

I wrote the code in PHP like this and I need to delete the rows from the database which “delete checkbox” in its delete column checked. And I want to send “verify” value (1 or 0) to the database. But I don’t know SQL command to delete checked rows and I don’t know how to get value of “verify” column (because it isn’t possible to get the value using $_POST[$id]).

   <?php
    echo "<form action=\"index.php?go=save\" method=\"POST\">
        <table width=\"335\" border=\"1\">
        <tr>
        <th width=\"19\" scope=\"col\">ID</th>
        <th width=\"31\" scope=\"col\">Title</th>
        <th width=\"33\" scope=\"col\">URL</th>
        <th width=\"52\" scope=\"col\">Visitors</th>
        <th width=\"28\" scope=\"col\">Hits</th>
        <th width=\"52\" scope=\"col\">Verify</th>
        <th width=\"27\" scope=\"col\">Edit</th>
        <th width=\"41\" scope=\"col\">Delete</th>
      </tr>";
     $query = mysql_query("SELECT * FROM posts ORDER BY visitors DESC");
    while($write = mysql_fetch_array($query)) {
        $id     = $write['id'];
        $title      = $write['title'];
        $url        = $write['url'];
        $visitors   = $write['visitors'];
        $hits       = $write['hits'];
    echo"   
      <tr>
        <td>$id</td>
        <td>$title</td>
        <td>$url</td>
        <td>$visitors</td>
        <td>$hits</td>
        <td>
        <input type=\"radio\" name=\"$id\"  value=\"1\" />Yes
        <input type=\"radio\" name=\"$id\"  value=\"0\" />No
        </td>
        <td><a href=\"index.php?go=edit\">Edit</a></td>
        <td>
          <input type=\"checkbox\" name=\"$id\" />
      </td>
      </tr>";
    }
    echo "</table>
        <input type=\"submit\" value=\"Save\"  />
        </form> ";
    ?>

Please, help me to solve this problem. If you know alternative variants, please write it.

  • 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-26T19:49:40+00:00Added an answer on May 26, 2026 at 7:49 pm

    Delete column:

    <input type=\"checkbox\" name=\"delete[]\" value=\"$id\" />
    

    Checking and deleting:

    foreach($_POST['delete'] as $id_to_delete) {
        mysql_query("DELETE FROM posts WHERE ID=".$id_to_delete)
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a PHP code like this $site=http://www.google.com; $content = file_get_content($site); echo $content; But
i wrote a code like this <?php $extCount = 0; foreach($this->externalReferal as $externalReferal) {
I need to write php code to identify common e-mail errors, like inbox full
I need to use Zend Captcha and wrote the follwoing code: <?php require_once ('Zend/Form.php');
i need to create an url like this: www.example.com/index.php/scheda/name-surname-id.html so i create the Scheda
I wrote this code I have these errors Cannot implicitly convert type x.Program.TreeNode' to
I wrote my code using this article at msdn as a primary helper My
I'd like to be able to run a line of PHP code on the
I need to pull several rows from a table and process them in two
I need to write a PHP page which would accept an XML document sent

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.