Example #1
0
function db_listbox($query, $default = "", $suffix = "\n")
{
    return db_query_loop($query, "<option", $suffix, " selected", $default);
}
Example #2
0
function db_listbox($query, $default = "", $suffix = "</option>\n")
{
    /* generate the <option> statements for a <select> listbox, based on the
     * results of a SELECT query ($query).  any results that match $default
     * are pre-selected, $default can be a string or an array in the case of
     * multi-select listboxes.  $suffix is printed at the end of each <option>
     * statement, and normally is just a line break */
    return db_query_loop($query, "<option", $suffix, "selected", $default);
}