#32517 [Opn->Bgs]: Bug in HTTP_POST_VARS with checkboxes
| From: | derick@php.net | Date: | Thu, 31 Mar 2005 14:20:36 +0000 |
| Subject: | #32517 [Opn->Bgs]: Bug in HTTP_POST_VARS with checkboxes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-76117@lists.php.net to get a copy of this message | ||
ID: 32517
Updated by: derick@php.net
Reported By: crandym2003 at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: CGI related
Operating System: Windows/Unix
PHP Version: 4.3.10
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
This is a browser "feature".
Previous Comments:
------------------------------------------------------------------------
[2005-03-31 16:17:53] crandym2003 at yahoo dot com
Description:
------------
When using HTML checkboxes in an application, the checkbox is not
recognized in HTTP_POST_VARS unless it is checked. If the checkbox is
checked, the value of "customer_active" is "on", however it the
checkbox is not checked, no value exists and HTTP_POST_VARS does not
recognize the entity "customer_active".
I believe HTTP_POST_VARS should always recognize a defined HTML entity
regardless of its state (i.e., checked or unchecked)
Reproduce code:
---------------
if ($m['customer_active'] == 'yes') {$customer_active = 'CHECKED';
} else {
$customer_active = '';
};
print '<form name=EditCustomer action="submit_customer.php"
method="post" enctype="multipart/form-data" onsubmit="return
CheckForm(this)">';
print '<tr>';
print '<td class=fieldname>Activate Customer:</td>';
print '<td class=formfield><input type="checkbox"
name="customer_active" '.$customer_active.' ></td>';
print '</tr>';
print '<TR>';
print '<TD width="20%" height="19"><INPUT class=FormAdmin
type="submit"
value="Submit" > <button class=FormAdmin type="button"
onclick="history.back()">Cancel</button></TD>';
print '<TD width="80%" height="19"></TD>';
print '</TR>';
Expected result:
----------------
If the checkbox is unchecked, the value of "customer_active" should be
"off" instead of HTTP_POST_VARS reporting that it is undefined.
Actual result:
--------------
If the checkbox "customer_active" is checked, then
HTTP_POST_VARS['customer_active'] has a value of 'on'. If it is
unchecked, there is no defined HTTP_POST_VARS['customer_active'].
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32517&edit=1