PX : code

Select Parser by Darrell Brogdon
Download this code


<? 

/* 
        $string:  the  deliniated  string  you  wish  to  parse  and  place  as  an  option  in  your  SELECT  statement 
        $delimiter:  the  delimiter  you  use  to  separated  the  fields  in  your  string.    Commas  (,)  or  Pipes  (|)  are  common  delimiters. 
*/ 

Function  select_parse($string,  $delimiter)  { 
        $options  =  split(  "[$delimiter]+",  $string  ); 

        for(  $i  =  0;  $options[$i];  $i++  )  { 
                echo  "<option>  $options[$i]\n"; 
                } 

        
$strText  =  "One,Two,Three,Four"; 
?> 

<FORM> 
<SELECT  NAME="test"> 
        <?  select_parse($strText,  ",");  ?> 
</SELECT>        
</FORM> 

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.