[PHP-DOC] Bug #12375: FAQ section on multiple select box From: rhampton <email protected>
Date: 07/25/01

From: rhampton <email protected>
Operating system: RH Linux 6.2
PHP version: 4.0.5
PHP Bug Type: Documentation problem
Bug description: FAQ section on multiple select box

'./configure' '--with-mysql' '--with-pgsql' '--with-udb' '--with-jpeg'
                                '--with-jpeg-dir=/usr/local'
'--with-xpm-dir=/usr/X11R6' '--with-xml' '--with-ftp'
                                '--with-gd' '--enable-trans-sid'
'--disable-magic-quotes' '--with-dom'
                                '--with-qtdom=/usr/local/qt' '--with-zlib'
'--with-mcal=../libmcal' '--with-ldap'
                                '--with-imap=../imap' '--with-gettext'
'--with-db3=/usr/local/BerkeleyDB.3.2'
                                '--with-mcrypt=/usr/local/lib'
'--enable-ftp' '--with-apxs=/usr/sbin/apxs'

############################
I have created an html page for a multiple select box:
If I have:
<SELECT MULTIPLE NAME="test[]">
<OPTION VALUE="10">10
<OPTION VALUE="20">20
<OPTION VALUE="30">30
<OPTION VALUE="40">40
</SELECT>

And I have a php script to look at the contents of test I get an error:

<?PHP
foreach ($test as $testing)
        {
        echo "$testing <br>\n";
        }
?>

If, however, I use the same code and make the VALUE="w","x","y","z"

I have found a workaround for using numeric values in VALUE= by encasing
them in tick marks
For example:
<OPTION VALUE="'10'">

and change my php script to:
<?PHP
foreach ($test as $testing)
        {
        $testing=stripslashes($testing);
        $testing=str_replace("'","",$testing);
        echo "$testing <br>\n";
        }
?>

Summary: looks like the test[] array isn't being populated right when the
value element in the option tag has a numeric value instead of character
value.

Rodney Hampton
www.hamptonandassociates.net
rhampton <email protected>

-- 
Edit bug report at: http://bugs.php.net/?id=12375&edit=1