#18861 [Opn->Bgs]: On a form, a "checkbox" array does not appear to be indexing properly.
| From: | yohgaki@php.net | Date: | Mon, 12 Aug 2002 03:25:09 +0000 |
| Subject: | #18861 [Opn->Bgs]: On a form, a "checkbox" array does not appear to be indexing properly. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-16521@lists.php.net to get a copy of this message | ||
ID: 18861
Updated by: yohgaki@php.net
Reported By: tony@cigardiary.com
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Linux thebe 2.2.14
PHP Version: 4.1.2
New Comment:
Sorry, but the bug system is not the appropriate forum for asking
support questions. 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
Thank you for your interest in PHP.
It does not work that way.
Get help from php-general.
Previous Comments:
------------------------------------------------------------------------
[2002-08-11 19:28:36] tony@cigardiary.com
The problem that I am having is that I have created an array of input
elements on a form, and I have been having problems with the checkbox
elements being passed appropriately.
When I fill in the form entries, I expect the corresponding values to
be populated, but when I select any of the checkboxes, for example, 1,
3, and 7... It always returns a Yes for 0,1, and 2.
This causes problems when I'm deleting the user's pictures based on
their selection. :)
Configure line follows.
---
'./configure' '--with-mysql'
'--with-apxs=/opt/apache-1.3.20/bin/apxs'
'--with-pear' '--with-openssl' '--with-imap'
'--with-imap-ssl'
'--with-curl' '--with-gd' '--with-png-dir=/usr/lib'
'--with-zlib-dir=/usr/lib' '--with-jpeg-dir=/usr/lib' '--with-ttf'
'--enable-track-vars' '--with-pspell' '--enable-ftp'
'--enable-memory-limit' '--enable-inline-optimization'
'--disable-debug' '--enable-safe-mode' '--enable-magic-quotes'
'--with-gettext' '--with-xml'
---
A sample script follows.
---
<?php
if (isset($submit)) {
for ($i=0; $i<26; $i++) {
echo 'i='.$i.' Image line='.$img[$i].' Text
line='.$txt[$i].'
Delete line='.$dlt[$i].'<BR>';
}
} else { // if (isset($submit))
?>
<FORM ENCTYPE="multipart/form-data" ACTION="<?php echo $PHP_SELF
?>?id=<?php echo $id ?>" METHOD=POST>
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="100000">
<TABLE CELLPADDING="3">
<?php
for ($j=0; $j<26; $j++) {
if ($j == 0) $imagedesc = 'Main Image'; else $imagedesc = 'Image
#'.$j;
echo '<TR><TD COLSPAN="2">'.$imagedesc.' <INPUT
NAME="img[]"
TYPE="file"> <INPUT TYPE="checkbox" NAME="dlt[]"
VALUE="Yes"> Delete?
</TD></TR>';
echo '<TR><TD>'.$image[$j].'</TD><TD><TEXTAREA
NAME="txt[]" ROWS="6"
COLS="30">'.$text[$j].'</TEXTAREA></TD></TR>';
}
?>
</TABLE>
<INPUT NAME="submit" TYPE="submit" VALUE="Send File(s)">
</FORM>
<?php
} // end of if isset($submit)
?>
---
Hope you can help,
-Tony
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18861&edit=1