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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:11:41+00:00 2026-06-09T06:11:41+00:00

I have a page with a dynamic table, filled with data from mysql database.

  • 0

I have a page with a dynamic table, filled with data from mysql database. The table isn’t just an ordinary table, one column contains a checkbox with a value of the id (primary key) of the database. But the data from mysql that i want to retrieve has spaces in between them.

Example:

id|name
1 |Chuck Norris
2 |Bruce Lee
3 |Jackie Chan

From the column name, I was able to get Chuck, Bruce and Jackie, but not Norris, Lee, and Chan.

i have to pages namely: delete.php and checkIt.php

a portion of delete.php contains
`

    $query = "SELECT * FROM account";
    $result = mysql_query($query) or die ("Query failed");
    $num = mysql_num_rows($result);

    echo "<form method='post' action='checkIt.php'><table>";
    if($num>0)
    {

        echo '<tr>
                <td></td>
                <td>ID</td>
                <td>NAME</td>';
        echo '</tr>';

        while($row = mysql_fetch_array($result))
        {   
            echo "<tr>
                    <td><input type='checkbox' name='names[]' value=".$row['name']."/></td>
                    <td>".$row['id']."</td>
                    <td>".$row['name']."</td>";
            echo "</tr>";
        }
    }
    echo "</table><br><input type='submit' value='Delete' /></form>";
?>`

and a portion of checkIt.php contains
`

for ($i=0; $i<count($_POST['names']); $i++)
{ 
    $name = $_POST['names'][$i]; 
    echo " ".$name;
    $sql="DELETE from account WHERE name='$name';";
    $result=mysql_query($sql);
}
?>`

$name from checkIt.php only gets one word. I would like to get the complete data from the mysql so that the DELETE will execute properly.
Any suggestions? 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-06-09T06:11:43+00:00Added an answer on June 9, 2026 at 6:11 am

    You need to enclose the value in your checkbox input in quotes.

    Right now it comes out as:

    <input type='checkbox' name='names[]' value=chuck norris/>
    

    Changing your echo to:

    echo "<tr>
              <td><input type='checkbox' name='names[]' value='".$row['name']."' /></td>
              <td>".$row['id']."</td>
              <td>".$row['name']."</td>";
    

    should solve the problem.

    Also, be sure to escape the $_POST parameters you are using in your query or else you are vulnerable to SQL Injection.

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

Sidebar

Related Questions

I have one table which display data as from Dynamic Content in 1 column.
I have a page with a dynamic table, data pulled from a GET method.
I have just meticulously followed MS instructions for customising a dynamic data page template
I have a dynamic table in my web page that sometimes contains lots of
I have a simple data table which contains dynamic form text fields. Each field
I have a web page that displays dynamic data which changes every 2 seconds.
I'm doing a dynamic table to collect passengers personal data. This table have above
I'm trying to get an html table from a dynamic php page on my
I have a dynamic list of categories, which is retrieved from mySQL. When the
I'm trying to make a dynamic table with PHP. I have a page which

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.