Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to select/unselect generated checkbox rows with a separate checkbox in header
    text
    copied!<p>can someone help me with my code, the code below would generate rows after the query, each row would have its own checkbox...i also have a checkbox in the header...what i want is to check or select all rows using only the checkbox in the header but at the same time i should still be able to select a checkbox per row</p> <pre><code>echo "&lt;table width='auto' cellpadding='1px' cellspacing='0px' border=1 align='center'&gt; &lt;tr&gt; &lt;th align='center'&gt;&lt;input name=checkall type=checkbox value='' /&gt;&lt;/th&gt; &lt;th align='center'&gt;Remedy Ticket No.&lt;/th&gt; &lt;th align='center'&gt;Phone/Incident No.&lt;/th&gt; &lt;th align='center'&gt;Category 2&lt;/th&gt; &lt;th align='center'&gt;Category 3&lt;/th&gt; &lt;th align='center'&gt;Status&lt;/th&gt; &lt;th align='center'&gt;Create Date&lt;/th&gt; &lt;th align='center'&gt;Severity&lt;/th&gt; &lt;th align='center'&gt;Ban Type&lt;/th&gt; &lt;th align='center'&gt;Resolved Date&lt;/th&gt; &lt;/tr&gt;"; while($info = mysql_fetch_array($myData)) { echo "&lt;form action='getdata.php' method='post'&gt;"; echo"&lt;tr&gt;"; echo "&lt;td align='center'&gt;" . "&lt;input type=checkbox name=checkbox value=" . " &lt;/td&gt;"; echo "&lt;td align='center'&gt;" . $info['ars_no'] . "&lt;input type=hidden name=ars_no value=" . $info['ars_no'] . " &lt;/td&gt;"; echo "&lt;td align='center'&gt;" . $info['phone_number'] . "&lt;input type=hidden name=phone_number value=" . $info['phone_number'] . " size='11' maxlength='11' /&gt; &lt;/td&gt;"; echo "&lt;td align='center'&gt;" . $info['category_1'] . "&lt;input type=hidden name=category_1 value=" . $info['category_1'] . "' /&gt; &lt;/td&gt;"; echo "&lt;td align='center'&gt;" . $info['category_2'] . "&lt;input type=hidden name=category_2 value=" . $info['category_2'] . "' /&gt; &lt;/td&gt;"; echo "&lt;td align='center'&gt;" . $info['status'] . "&lt;input type=hidden name=status value=" . $info['status'] . "' /&gt; &lt;/td&gt;"; echo "&lt;td align='center'&gt;" . $info['create_date'] . "&lt;input type=hidden name=create_date value=" . $info['create_date'] . "' /&gt; &lt;/td&gt;"; echo "&lt;td align='center'&gt;" . $info['trouble_type_priority'] . "&lt;input type=hidden name=trouble_type_priority value=" . $info['trouble_type_priority'] . " size='1' maxlength='1' /&gt; &lt;/td&gt;"; echo "&lt;td align='center'&gt;" . $info['ban_type'] . "&lt;input type=hidden name=ban_type value=" . $info['ban_type'] . " size='1' maxlength='1' /&gt; &lt;/td&gt;"; echo "&lt;td align='center'&gt;" . "&lt;input type=text name=resolved_date value=" . $info['resolved_date'] . " size='8' maxlength='8' /&gt; &lt;/td&gt;"; </code></pre>
 

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