-function select_options($table,$valeur,$champ="text",$pad=false,$where="") {
- $sql = "SELECT id,$champ FROM $table $where ORDER BY $champ";
+function select_options($table,$valeur,$champ="text",$pad=false,
+ $where="",$join="",$group="")
+{
+ $fields = 't.id,' . $champ;
+ $order = $champ;
+ if ($group) {
+ $fields .= ',' . $group;
+ $order = $group . ',' . $order;
+ }
+ $sql = "SELECT $fields FROM $table AS t $join $where ORDER BY $order";