<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>
<head><title><?php echo $phpName; ?></title></head>
<body>
<h2><?php echo $phpName; ?></h2>
<i>[<?php echo $phpSelf; ?>] @ <?php echo $phpTimeRan; ?></i>
<br><br>

<form action="<?php echo $phpSelf; ?>" method="POST">
<table
bgcolor="#003300"
cellpadding="4"
cellspacing="0"
border="4"
bordercolor="#000000"
style="color:#ffffff;">
<tr><td>Item</td></tr>
<tr> <td><select name="submitID" size="5" MULTIPLE>
<?php

for ($i=0;$i<10;$i++) {
echo '<option value="'.$i.'">'.$i.'</option>'."\n";
}

?>
</select></td>
</tr>
</table>
<br><br>
<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 '<br><br><hr>';
highlight_file($phpFile);
?>
</body>
</html>





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

Reply via email to