$box=$_POST['box']; $str=''; foreach($box as $key => $val) { $str=$str. "$val,"; } $str=rtrim($str,','); // To remove last char using rtrim echo "<pre><code>$str</code></pre>"; echo "<form method=post action=''>"; echo "<table border='0' cellspacing='0' style='border-collapse: collapse' width='100' > <tr bgcolor='#ffffff'> <td width='25%'><input type=checkbox name=box[] value='John'></td> <td width='25%'> John</td> <td width='25%'><input type=checkbox name=box[] value='Mike'></td> <td width='25%'> Mike</td> <td width='25%'><input type=checkbox name=box[] value='Rone'></td> <td width='25%'> Rone</td> </tr> <tr bgcolor='#f1f1f1'> <td width='25%'><input type=checkbox name=box[] value='Mathew'></td> <td width='25%'> Mathew</td> <td width='25%'><input type=checkbox name=box[] value='Reid'></td> <td width='25%'> Reid</td> <td width='25%'><input type=checkbox name=box[] value='Simon'></td> <td width='25%'> Simon</td> </tr> <tr><td colspan =6 align=center><input type=submit value=Select></form></td></tr> </table>";
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.
18-06-2012