View Full Version : create multiple checkbox with [print_checkbox_row]
omardealo
09-28-2014, 02:02 AM
Hello ,
i have a problem with [print_checkbox_row] when create multiple checkbox from array
Shows only one checkbox !
$fantasy = $db->query_first("SELECT * FROM " . TABLE_PREFIX . " quiz_fantasy ");
// data in column "playerarray" : ahmed,mohamed,omar
$playerarray = explode(",",$fantasy[playerarray]);
// note : when print_r($playerarray);
// output : Array ( [0] => ahmed [1] => mohamed [2] => omar )
print_checkbox_row('This is a checkbox row', 'inputname', 2, $playerarray);
Lynne
09-28-2014, 04:27 PM
print_checkbox_row prints a SINGLE row/checkbox. It won't print from an array. You'll need to put that into a loop.
omardealo
09-28-2014, 06:09 PM
print_checkbox_row prints a SINGLE row/checkbox. It won't print from an array. You'll need to put that into a loop.
yeah i know , i can loop it
foreach($playerarray as $player)
{
print_checkbox_row($player, 'inputname', $player);
}
but i search about a good and another solution , i want all checkbox on one only row and Every two or three in each line, like as
print_radio_row OR print_membergroup_row ..
is there another solution ?!
thnx ,Lynne
Those functions are in includes/adminfunctions.php, and they're pretty simple. Maybe what you could do is copy one of them and change it to do what you want. print_checkbox_row() puts each one in a div tag, which puts them on separate lines by default. So maybe you could copy that function, put in a loop to go through an array, take out the <div> (or change the display type to inline), and output a <br> tag when you want a new row.
omardealo
09-28-2014, 09:29 PM
Those functions are in includes/adminfunctions.php, and they're pretty simple. Maybe what you could do is copy one of them and change it to do what you want. print_checkbox_row() puts each one in a div tag, which puts them on separate lines by default. So maybe you could copy that function, put in a loop to go through an array, take out the <div> (or change the display type to inline), and output a <br> tag when you want a new row.
i saw a functions in includes/adminfunctions.php already
maybe that's a good way , but i see the loop is esay for me
thnx anyway for your help, kh99
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.