Copy the Code code as follows:
/*—————————————————— */
– Recursive implementation of infinite classification generation drop-down list function
– $tpl->assign (' Sort_list ', createsortoptions ());
– $tpl->assign (' Sort_list ', createsortoptions ($sort _id));
/*—————————————————— */
function Createsortoptions ($selected =0, $parent _id=0, $n =-1)
{
Global $db;
$sql = "SELECT * from ' @__article_sort ' WHERE ' parent_id ' = ' {$parent _id} '";
$options = ";
static $i = 0;
if ($i = = 0)
{
$options. = '
if ($row [' sort_id '] = = $selected)
{
$options. = ' selected ';
}
$options. = ">". Str_repeat (', $n). $row [' Sort_name ']. " \ n ";
$options. =createsortoptions ($selected, $row [' sort_id '], $n);
}
}
return $options;
}
The above describes the Commercial Bank loan classification PHP recursive implementation of unlimited classification to generate a drop-down list of functions, including the Commercial Bank loan classification of the content, I hope the PHP tutorial interested in a friend helpful.