What i want: you can choose multiple items from the selectbox. Because everything is required in my form i want to remember what already has been filled in, in case someone forgets something. When you choose to proceed the array onthoud_w[] is filled with the chosen values from the selectbox. Now you will return because not everything is filled in. Everytime when i have selected two items only one is still selected when I return. And onthoud_w[] really has two items in it. This is the code, i hope someone can help me out here.
<select multiple="multiple" name="woningtype[]" size="5" class="selectbox">
<?php
//remenber every selected item.
if($woningtype)
{
$j=0;
for($i=0;$i<count($onthoud_w);$i++)
{
for($j=0;$j<count($w_id);$j++)
{
if($w_id[$j]==$onthoud_w[$i])
{
?>
<option value="<?php echo "$w_id[$j]";?>" selected="Selected">
<?php echo "$soort[$j]" ;?>
</option>
<?php
} else {
?>
<option value="<?php echo "$w_id[$j]";?>">
<?php echo "$soort[$j]" ;?>
</option>
<?php
}//end else
}//end for
}//end for
} else {
for($j=0;$j<$a;$j++)
{
?>
<option value="<?php echo "$w_id[$j]";?>">
<?php echo "$soort[$j]" ;?>
</option>
<?php
}//end for
}//end else
?>
</select>