diff --git a/qanda.php b/qanda.php
index 7d08087b33b..487ddd2245c 100644
--- a/qanda.php
+++ b/qanda.php
@@ -572,6 +572,15 @@ function do_list_radio($ia)
global $dbprefix, $dropdowns, $dropdownthreshold, $lwcdropdowns;
global $shownoanswer;
$answer="";
+ $qidattributes=getQuestionAttributes($ia[0]);
+ if ($displaycols=arraySearchByKey("display_columns", $qidattributes, "attribute", 1))
+ {
+ $dcols=$displaycols['value'];
+ }
+ else
+ {
+ $dcols=0;
+ }
if (isset($defexists)) {unset ($defexists);}
$query = "SELECT other FROM {$dbprefix}questions WHERE qid=".$ia[0];
$result = mysql_query($query);
@@ -579,11 +588,26 @@ function do_list_radio($ia)
$ansquery = "SELECT * FROM {$dbprefix}answers WHERE qid=$ia[0] ORDER BY sortorder, answer";
$ansresult = mysql_query($ansquery) or die("Couldn't get answers $ansquery ".mysql_error());
$anscount = mysql_num_rows($ansresult);
- $answer .= "\n\t\t\t\t\t
\n"
- . "\t\t\t\t\t\t
\n"
- . "\t\t\t\t\t\t\t
\n";
+ $divider="";
+ $maxrows=0;
+ if ($dcols >0 && $anscount > $dcols) //Break into columns
+ {
+ $denominator=$dcols; //Change this to set the number of columns
+ $width=sprintf("%0d", 100/$denominator);
+ $maxrows=ceil(100*($anscount/$dcols)/100); //Always rounds up to nearest whole number
+ $answer .= "
\n"
@@ -962,10 +991,10 @@ function do_multiplechoice($ia)
$maxrows=0;
if ($dcols >0 && $anscount > $dcols) //Break into columns
{
- $denominator=$dcols; //Change this to set the number of columns
- $width=sprintf("%0d", 100/$denominator);
- $maxrows=sprintf("%0d", $anscount/$denominator)+1;
- $answer .= "
\n
";
+
+ $width=sprintf("%0d", 100/$dcols);
+ $maxrows=ceil(100*($anscount/$dcols)/100); //Always rounds up to nearest whole number
+ $answer .= "