<?php

/*

powered by Trésor Sukami

Sépia Technologies 

version 1.2

*/

function combobox($param=[]){

    $ret='';

    $default=$param['default']??'<NULL>';



    $id=$param['id']??'id';

    $lib=$param['lib']??'lib';

    foreach($param['data']??[] as $item):

        $selected=$default==$item[$id]?'selected="selected"':'';

        $ret.= '<option '.$selected.' value="'.$item[$id].'">'.$item[$lib].'</option>';

    endforeach;



    foreach($param['array']??[] as $item):

        $selected=$default==$item?'selected="selected"':'';

        $ret.= '<option '.$selected.' value="'.$item.'">'.$item.'</option>';

    endforeach;



    foreach($param['list']??[] as $key->$value):

        $selected=$default==$key?'selected="selected"':'';

        $ret.= '<option '.$selected.' value="'.$key.'">'.$value.'</option>';

    endforeach;

    return $ret;

}



function addslashes_array($array){

    $ret=[];

    foreach($array as $k=>$v){

        $ret[$k]=addslashes($v);

    }

    return $ret;

}