Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to delete checked columns and send value of radio button?
    primarykey
    data
    text
    <p>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 <code>$_POST[$id])</code>. </p> <pre><code> &lt;?php echo "&lt;form action=\"index.php?go=save\" method=\"POST\"&gt; &lt;table width=\"335\" border=\"1\"&gt; &lt;tr&gt; &lt;th width=\"19\" scope=\"col\"&gt;ID&lt;/th&gt; &lt;th width=\"31\" scope=\"col\"&gt;Title&lt;/th&gt; &lt;th width=\"33\" scope=\"col\"&gt;URL&lt;/th&gt; &lt;th width=\"52\" scope=\"col\"&gt;Visitors&lt;/th&gt; &lt;th width=\"28\" scope=\"col\"&gt;Hits&lt;/th&gt; &lt;th width=\"52\" scope=\"col\"&gt;Verify&lt;/th&gt; &lt;th width=\"27\" scope=\"col\"&gt;Edit&lt;/th&gt; &lt;th width=\"41\" scope=\"col\"&gt;Delete&lt;/th&gt; &lt;/tr&gt;"; $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" &lt;tr&gt; &lt;td&gt;$id&lt;/td&gt; &lt;td&gt;$title&lt;/td&gt; &lt;td&gt;$url&lt;/td&gt; &lt;td&gt;$visitors&lt;/td&gt; &lt;td&gt;$hits&lt;/td&gt; &lt;td&gt; &lt;input type=\"radio\" name=\"$id\" value=\"1\" /&gt;Yes &lt;input type=\"radio\" name=\"$id\" value=\"0\" /&gt;No &lt;/td&gt; &lt;td&gt;&lt;a href=\"index.php?go=edit\"&gt;Edit&lt;/a&gt;&lt;/td&gt; &lt;td&gt; &lt;input type=\"checkbox\" name=\"$id\" /&gt; &lt;/td&gt; &lt;/tr&gt;"; } echo "&lt;/table&gt; &lt;input type=\"submit\" value=\"Save\" /&gt; &lt;/form&gt; "; ?&gt; </code></pre> <p>Please, help me to solve this problem. If you know alternative variants, please write it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload