{"id":289,"date":"2009-04-03T00:45:12","date_gmt":"2009-04-03T00:45:12","guid":{"rendered":"http:\/\/www.phpmind.com\/blog\/?p=289"},"modified":"2010-07-17T01:35:45","modified_gmt":"2010-07-17T01:35:45","slug":"how-to-collect-checkbox-array-values","status":"publish","type":"post","link":"https:\/\/www.phpmind.com\/blog\/2009\/04\/how-to-collect-checkbox-array-values\/","title":{"rendered":"How to collect Checkbox Array values?"},"content":{"rendered":"<p>Beginner PHP Programmer always searches for easy way to collect Checkbox data from forms.<br \/>\nHere in this post I have used 3-4 lines of easy code to collect data from multi checkboxes. Instead of using several table-fields you can store your comma separated data in on field of the table. This is easy and handy.<\/p>\n<pre lang=\"LANGUAGE\" line=\"1\">\r\n<?php\r\n$name_box = $_REQUEST[\"name_box\"];\r\nwhile (list ($key_check,$val_check) = @each ($name_box))\r\n\t{\r\n\t\t$value_check .= $val_check.\",\";\r\n\t}\r\n\r\n\t$all_value_check = substr($value_check, 0, -1);  \r\n\r\n\techo $all_value_check;\r\n\r\n?>\r\n\r\n<form method=\"post\">\r\n<table style=\"border-collapse: collapse\" border=\"0\" cellspacing=\"0\" width=\"100\">\r\n<tbody>\r\n<tr bgcolor=\"#ffffff\">\r\n<td width=\"25%\">\r\n<input name=\"name_box[]\" type=\"checkbox\" value=\"Om\" \/><\/td>\r\n<td width=\"25%\">\u00a0Om<\/td>\r\n<td width=\"25%\">\r\n<input name=\"name_box[]\" type=\"checkbox\" value=\"Jyoti\" \/><\/td>\r\n<td width=\"25%\">\u00a0Jyoti<\/td>\r\n<td width=\"25%\">\r\n<input name=\"name_box[]\" type=\"checkbox\" value=\"Bruce\" \/><\/td>\r\n<td width=\"25%\">\u00a0Bruce<\/td>\r\n<\/tr>\r\n<tr bgcolor=\"#f1f1f1\">\r\n<td width=\"25%\">\r\n<input name=\"name_box[]\" type=\"checkbox\" value=\"Yaling\" \/><\/td>\r\n<td width=\"25%\">\u00a0Yaling<\/td>\r\n<td width=\"25%\">\r\n<input name=\"name_box[]\" type=\"checkbox\" value=\"Angelica\" \/><\/td>\r\n<td width=\"25%\">\u00a0Angelica<\/td>\r\n<td width=\"25%\">\r\n<input name=\"name_box[]\" type=\"checkbox\" value=\"Tara\" \/><\/td>\r\n<td width=\"25%\">\u00a0Tara<\/td>\r\n<\/tr>\r\n<tr>\r\n<td colspan=\"6\" align=\"center\">\r\n<input type=\"submit\" value=\"Select\" \/><\/td>\r\n<\/tr>\r\n<\/tbody><\/table>\r\n<\/form>\r\n  \r\n \r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Beginner PHP Programmer always searches for easy way to collect Checkbox data from forms. Here in this post I have used 3-4 lines of easy code to collect data from multi checkboxes. Instead of using several table-fields you can store your comma separated data in on field of the table. This is easy and handy. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-289","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/289","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/comments?post=289"}],"version-history":[{"count":18,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/289\/revisions"}],"predecessor-version":[{"id":855,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/289\/revisions\/855"}],"wp:attachment":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/media?parent=289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/categories?post=289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/tags?post=289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}