#32517 [NEW]: Bug in HTTP_POST_VARS with checkboxes
| From: | crandym2003 at yahoo dot com | Date: | Thu, 31 Mar 2005 14:17:54 +0000 |
| Subject: | #32517 [NEW]: Bug in HTTP_POST_VARS with checkboxes | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-76116@lists.php.net to get a copy of this message | ||
From: crandym2003 at yahoo dot com
Operating system: Windows/Unix
PHP version: 4.3.10
PHP Bug Type: CGI related
Bug description: Bug in HTTP_POST_VARS with checkboxes
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 bug report at http://bugs.php.net/?id=32517&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32517&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32517&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32517&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32517&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32517&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32517&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32517&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32517&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32517&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32517&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32517&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32517&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32517&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32517&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32517&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32517&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32517&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32517&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32517&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32517&r=mysqlcfg