I have the following code:
$pages=10;
$pages_list='';
if($pages>1){
for($i = 1; $i<=$pages; $i++){
$pages_list.='<label class="am-pages> [ '.$i.' ] </label> ';
}
}
The result is as follows:
[ 2 ] [ 4 ] [ 6 ] [ 8 ] [ 10 ]
Expected to be:
[ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ]
Please tell me, where did I go wrong?
>Solution :
Becuase you missed " class="am-pages> here. add " after class="am-pages"> will work
$pages=10;
$pages_list='';
if($pages>1){
for($i = 1; $i<=$pages; $i++){
$pages_list.='<label class="am-pages"> [ '.$i.' ] </label> ';
}
}