You Wrote
Therefore I need to automatically using code select all items in the list to enable the array to be populated. HOW?
Whether or not you are using an ARRAY or DB isn't important -- they both can be used with the code I gave you -- if you want all the items to be selected, just ad the SELECTED command in your <SELECT></SELECT>
Like so:
<SELECT NAME="items[]" size="12" MULTIPLE>
<?
foreach($myChoices as $key=>$value)
{
print('<option value="' . $key . '" ' . 'SELECTED>' . $value . '</option>');
}
?>
</SELECT>
Your question is quisi-clear... a bit confusing. Is your SELECT list dynamic?
Are you using SESSIONS?
Another thing you could do is store the data in a hidden field, then just pass it normally.
An example would be:
<SELECT NAME="items[]" size="12" MULTIPLE>
<?
foreach($myChoices as $key=>$value)
{
print('<option value="' . $key . '"> . $value . '</option>');
$dynArray[$key] = $value; // need to build array here.
}
?>
</SELECT>
<form>
<?
// Store array as string
$mySelList = htmlspecialchars(serialize($dynArray));
// need to use HTMLSPECIALCHARS so that the string will not be 'snipped' by the quotes generated by the SERIALIZE function. PHP will automatically convert this back to it's normal string when passed.
<input type="hidden" name="selList" value="<?print($mySelList);?>">
?>
This will turn your array into a string which can easily be stored in a Hidden Field...
On page2 use the following:
<?
$mySelList = unserialize($selList);
foreach($mySelList as $key=>$value)
{
print('<option value="' . $key . '"> . $value . '</option>');
}
?>
I hope this is what you were looking for :-)
Jason