PHP infinite classification drop-down list classification (Part 2)
"; foreach ($rs as $key=>$val){ echo ""; } echo'
Beautify the obtained data to get the above picture style, which is infinite classification.
For the convenience of future calls, we encapsulate the recursive function.
"; foreach ($rs as $key=>$val){ $selectedstr=''; if ($val['id'] == $selected){ $selectedstr="selected"; } $str.=""; } return $str.=''; } echo displayCate(0,2); ?>
This completes our infinite category list style.