Re: [PHP] Does PHP recognize multiple selections in a form?

2002-12-27 Thread Marco Tabini
Hello Micah--

Yes, PHP supports multiple selections, but you need to change the name
of the control from submitID to submitID[], so that it will become an
array once inside your script.

Hope this helps!


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

---BeginMessage---
grrr... I am trying to get several values from a selection form field (using
multiple) into PHP.  Is this possible?  The code I'm using to test this is
below.  After running the code and selecting more than one field, the last
field (the greatest number) is the only one that shows up as the only input
from the selection part of the form!!  Is there any other way??

thanks,
Micah



?php
$phpSelf = $_SERVER['SCRIPT_NAME'];
$phpFile = $_SERVER['SCRIPT_FILENAME'];
$phpName = 'Multiple Selection Test';
$phpTimeRan = date('H:i.s');
$a='a';
$b='b';
?
html
headtitle?php echo $phpName; ?/title/head
body
h2?php echo $phpName; ?/h2
i[?php echo $phpSelf; ?] @ ?php echo $phpTimeRan; ?/i
brbr

form action=?php echo $phpSelf; ? method=POST
table
 bgcolor=#003300
 cellpadding=4
 cellspacing=0
 border=4
 bordercolor=#00
 style=color:#ff;
trtdItem/td/tr
tr tdselect name=submitID size=5 MULTIPLE
?php

 for ($i=0;$i10;$i++) {
  echo 'option value='.$i.''.$i.'/option'.\n;
 }

?
/select/td
/tr
/table
brbr
input type=hidden name=a value=?php echo $a; ?
input type=hidden name=b value=?php echo $b; ?
input type=submit name=submit
/form
?php

echo 'textarea readonly rows=12 cols=50 name=NULL';
var_dump($_POST);
echo '/textarea';

echo 'brbrhr';
highlight_file($phpFile);
?
/body
/html



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



---End Message---
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Does PHP recognize multiple selections in a form?

2002-12-27 Thread Marek Kilimajer
select name=submitID[] size=5 MULTIPLE
 ^^
Then $_POST['submitID'] will be an array with selected options

Micah Bushouse wrote:

grrr... I am trying to get several values from a selection form field (using
multiple) into PHP.  Is this possible?  The code I'm using to test this is
below.  After running the code and selecting more than one field, the last
field (the greatest number) is the only one that shows up as the only input
from the selection part of the form!!  Is there any other way??

thanks,
Micah



?php
$phpSelf = $_SERVER['SCRIPT_NAME'];
$phpFile = $_SERVER['SCRIPT_FILENAME'];
$phpName = 'Multiple Selection Test';
$phpTimeRan = date('H:i.s');
$a='a';
$b='b';
?
html
headtitle?php echo $phpName; ?/title/head
body
h2?php echo $phpName; ?/h2
i[?php echo $phpSelf; ?] @ ?php echo $phpTimeRan; ?/i
brbr

form action=?php echo $phpSelf; ? method=POST
table
bgcolor=#003300
cellpadding=4
cellspacing=0
border=4
bordercolor=#00
style=color:#ff;
trtdItem/td/tr
tr tdselect name=submitID size=5 MULTIPLE
?php

for ($i=0;$i10;$i++) {
 echo 'option value='.$i.''.$i.'/option'.\n;
}

?
/select/td
/tr
/table
brbr
input type=hidden name=a value=?php echo $a; ?
input type=hidden name=b value=?php echo $b; ?
input type=submit name=submit
/form
?php

echo 'textarea readonly rows=12 cols=50 name=NULL';
var_dump($_POST);
echo '/textarea';

echo 'brbrhr';
highlight_file($phpFile);
?
/body
/html



 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php