Date: 07/25/01
- Next message: Damien Seguy: "[PHP-DOC] cvs: phpdoc /fr/functions curl.xml"
- Previous message: Damien Seguy: "[PHP-DOC] cvs: phpdoc /fr/functions cybermut.xml"
- In reply to: rhampton <email protected>: "[PHP-DOC] Bug #12375: FAQ section on multiple select box"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 12375
Updated by: torben
Reported By: rhampton <email protected>
Old Status: Open
Status: Feedback
Bug Type: Documentation problem
Operating System: RH Linux 6.2
PHP Version: 4.0.5
New Comment:
First off, it'd be quite helpful to know exactly what error you're getting. 'An error' doesn't really tell
us anything useful. :)
Secondly, I just tried this script and it worked fine. What results does it give you that you do not
expect? (FWIW, the script you posted will give an undefined variable error when the page is first
loaded since it's trying to iterate over the $test array, which doesn't exist until you submit the form).
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML-3.2//EN">
<html>
<head>
<title></title>
</head>
<body>
<form action="__phplist.html" method="post">
<SELECT MULTIPLE NAME="test[]">
<OPTION VALUE="10">10
<OPTION VALUE="20">20
<OPTION VALUE="30">30
<OPTION VALUE="40">40
</SELECT>
<input type="submit">
</form>
<pre>
<?php
error_reporting(E_ALL);
if (!empty($test)) {
print_r($test);
}
?>
</pre>
</body>
</html>
Previous Comments:
------------------------------------------------------------------------
[2001-07-25 15:13:05] rhampton <email protected>
'./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 this bug report at http://bugs.php.net/?id=12375&edit=1
- Next message: Damien Seguy: "[PHP-DOC] cvs: phpdoc /fr/functions curl.xml"
- Previous message: Damien Seguy: "[PHP-DOC] cvs: phpdoc /fr/functions cybermut.xml"
- In reply to: rhampton <email protected>: "[PHP-DOC] Bug #12375: FAQ section on multiple select box"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

