Forum Moderators: coopster
I have a multiple selection list/menu with list of states. User holds Ctrl key and selects desired states.
Once states are selected user hits submit and all selected states are passed through post variable to the next page.
That part is all fine, selected states are passed and it works.
What I would like to also be able to do is get the number of all states selected.
For example: when <? I echo $states;?>
I get list of all selected states.
Is there a command or a way to retrieve number of states selected? for example if user selected 4 states (Alabama, New York, Texas, Florida) in addition to the list I would also like to get the total number of selected states. In this case the number would be 4. This could be assigned to a new variable for example:
<? $TotalStatesSelected?>
I hope this make sense... Does anyone know how to achieve this?
Thank you
Dariusz
<select name="whatever[]" .... that will pass an array.
In the processing page, $states would hold the array.
count($states) would give you the number selected. You can then loop through the array to do whatever else you need. Hope that helps.
-sned