hi everyone

i have a "multi select drop down field" in a form. i now want to make this imput field sticky i.e for the values that have been previouly selected by a user to show as selected fields.

it might be best if i show u what i have done so far. i would really appriciate advice on how to proceed.

PHP Code:
<?php  
//initilize the values
    
$source4='';   $fleunt_lang=''$LANGUANAGE_pref=''
                              
        
//return the values from the select box 
              
if(isset($_POST['fleunt_lang']))
                      {          
                
$lang_pref $_POST['fleunt_lang'];
                foreach (
$lang_pref as $country
                    {
$source1 .= $country.", ";}
                    
$language_pref substr($source10, -2);
                
                  
$LANGUANAGE_pref   mysqli_real_escape_string($dbc,trim($language_pref  ));
                
                      }

//place the values into an array 
          
                     
$arr1 = array(    $LANGUANAGE_pref );
                  
?>
    <?php  
  THE IMPUT BOX
  
//lang_list() is taken from a database of languages-plus their Id


function  country_list (    )
         {
             global 
$dbc;
        
            
$select "  SELECT  
                       country_id,
                      country  "
;
                         
                      
$from   "    FROM
            countrylist  "
;
            
         
$query $select.$from  ;
             
$result mysqli_query ($dbc$query);
         return 
$result 
                  }  





    
//i will later attempt to check if the $langauge_id is in the Array-the array was previouly supplied from the returned values above. 
    
  
echo'       <form action= ""  method="post" name="form_jobsort"    id="form_jobsort "       >
       
                   
            
     
    
         <select name="fleunt_lang[]" id ="fleunt_lang"      multiple="multiple"       size="6"       style="font-family: Tahoma; width: 300px;     font-size: 12pt" >'
;
          
    
       
      
$language_list      =    language_list( );
     
    while  (
$row mysqli_fetch_array $language_listMYSQLI_ASSOC)) 
        
    {     
        
        
        
$language_id =   safe_output$row['language_id']) ;
        
$language  =   safe_output$row['language']) ;
        
        
            

       if (
in_array($language_id,   $arr1))
            {
                  echo 
'<option value="' $language_id  .'" selected>' .$language  '</option>';
            }
          else
            {
            echo 
'<option value="' .$language_id  .'">' $language '</option>';
            }
                        
            
            
     
    } echo
'</select>'';

?>

</form>
i am not sure if its clear what i was trying to do. i will explain :

i was collected the values that were selected by the user when they submitted the form and then placing them in an array so that i could later use the IN_array() funciton to determin whether those values had been previouly selected.

i.e


PHP Code:
       if (in_array($language_id,   $arr1))
            {
                  echo 
'<option value="' $language_id  .'" selected>' .$language  '</option>';
            }
          else
            {
            echo 
'<option value="' .$language_id  .'">' $language '</option>';
            } 
i have since been advised that my method of trying to place the submitted values into an array was incorrect and that all i did was to place the returned values into a stirng.

If, so, does anyone have any advice how i can place the returned values into an array?

if this method of trying to make the select filed sticky is not the best way to do this, then i would really appriciate some advice on the best way to do this.

warm regards

Andreea