Edit report at https://bugs.php.net/bug.php?id=21696&edit=1
ID: 21696 Comment by: jmichae3 at yahoo dot com Reported by: ivanpisa at dfm dot ffclrp dot usp dot br Summary: Checkbox is strange in POST event Status: No Feedback Type: Bug Package: *General Issues Operating System: Windows 2000 PHP Version: 4.3.0 Block user comment: N Private report: N New Comment: browser, client side only gives the same results (somename=on for checked, nonexistent for unchecked), even if using DHTML to access the control's arguments from GET (examine the URL) in chrome, IE10, opera, safari (ff buggy, checkboxes don't work for GET in ff23, submitted bug report). my test case is my DHTML code which uses submit to .html file http://JesusnJim.com/calculators/finances/calculator-with-estimator-to-save-up-for-item.html try with and without checkbox checked. I put in a w3c bug report to this effect for a change to have consistency of operation. something may or may not change in HTML5. Previous Comments: ------------------------------------------------------------------------ [2009-05-19 04:25:40] mj at ungesundleben dot org Same problem with PHP 5.1.4, Windows XP and Xampp 1.5.3a. The problem is especially: How to create a CSV file from post data without explicitely handling checkbox fields by their names if some checkbox fields "vanish"? You will get an unusable CSV file, because the order of the fields gets mismatched. Workaround: Inside the form, create checkboxes, which always are checked, but hidden for the user (using CSS), like this: <input style="display:none" type="checkbox" name="test_chk[]" value="phpbug" checked> <input class="checkbox" type="checkbox" name="test_chk[]" value="TRUE"> Within a loop foreach ($_POST as $key=>$value) through the post data, you then can do sth. like this: if (strpos($key,"_chk")) { if (isset($_POST[$key][1])) {$v='TRUE';} else {$v='FALSE';}; } Regards, Maike ------------------------------------------------------------------------ [2008-09-21 11:12:33] jeff at powerupmobile dot com Same problem with me: Solaris 10 PHP 5.2.5 Apache 2.2.8 Seems like a simple problem to me, PHP doesn't seem to recognise when a form checkbox is submitted with no value. I guess there are several ways to work around it but would be nice if it recognised it like it recognises and empty text field. ------------------------------------------------------------------------ [2003-01-31 13:50:10] sni...@php.net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. ------------------------------------------------------------------------ [2003-01-17 20:17:34] sni...@php.net If you're really using Apache2, consider moving to Apache 1.3.27 which actually works. ------------------------------------------------------------------------ [2003-01-17 09:10:07] hholz...@php.net are you sure that your error_reporting settings are really the same on both boxes? (pleas check in phpinfo() output) the message you see is only produced if E_NOTICE reporting is enabled ... ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=21696 -- Edit this bug report at https://bugs.php.net/bug.php?id=21696&edit=1