PHP infinite classification drop-down list classification (Part 2)

"; foreach ($rs as $key=>$val){ echo ""; } echo'' ?>

QQ截图20161029103008.png

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.="{$val['catename']}"; } return $str.=''; } echo displayCate(0,2); ?>

This completes our infinite category list style.

Continuing Learning
||
"; foreach ($rs as $key=>$val){ $selectedstr=''; if ($val['id'] == $selected){ $selectedstr="selected"; } $str.="{$val['catename']}"; } return $str.=''; } echo displayCate(0,2); ?>
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!