// retrieve possible resolutions $res_list = `/usr/bin/scanimage --help | grep -m 1 resolution`; $start=strpos($res_list,"n")+2; $length = strpos($res_list,"dpi") -$start; $list = "".substr($res_list,$start,$length).""; unset($start); unset($length); // change "|" separated string $list into array $resolution values. $resolution = explode("|",$list); //generate html selectbox and store in string $res_box $res_box = html_selectbox(resolution,$resolution,$resolution); //display the select box echo "$res_box";