<p>Hi, I have a list checkboxes being created from my DB, I need some help formating
my results in a HTML table which is 4 cols X 3 rows , instead of 12 cols X 1 row wide. I cant seem
to get this right without breaking the code which generates my list of checkboxes....<br>
</p>
<p> i.e. i need to format my results from this: </p>
<table width="100" border="1">
<tr>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
</tr>
</table>
<b><p>to:</p></b>
<p> </p>
<table width="100" border="1">
<tr>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
</tr>
<tr>
<td height="28">
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td height="28">
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td height="28">
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td height="28">
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
<td>
<input type="checkbox" name="rFeat[]" value="checkbox">
</td>
</tr>
</table>
<p> </p>
<p> </p>
<p>Can anyone offer some suggestions on this ?? The code which generates my long
list of checkboxes (12 cols wide ) is given below: </p>
$theSQLFeatures = "SELECT feature_id, feature_desc ".
"FROM carsforsalefeatures ".
"order by feature_desc";
$resultSet2=mysql_query($theSQLFeatures, $inDbConn2);
//echo $theSQLFeatures;
$vFeatCnt = count($rFeat);
echo"<table width=\"750\" border=\"1\" cellspacing=\"5\" cellpadding=\"5\" align=\"center\">";
//secho "<tr align=\"center\"><td colspan=\"4\"> Extras</td></tr>";
$numberofrows =mysql_num_rows($resultSet2);
$rows = ceil($numberofrows/4); // 4 columns in a row ....gives numbers of rows required rounded up to next integer
echo "numberofrows = $rows";
while ($theResult2 = mysql_fetch_row($resultSet2)) {
echo "<td><input type=\"checkbox\" name=\"rFeat[]\" value =\"$theResult2[0]\"";
if (is_array($rFeat)&& (count($rFeat) >0 ) )
{
foreach($rFeat as $aKey => $aValue)
{
if (!is_array($aValue)) {
if(empty($aValue)) {
echo "";
}
else {
//echo "ARRAY = $aKey, $aValue<BR>";
if ($aValue == $theResult2[0]){
echo "checked";
}
else {
echo "";
}
}
}
}
}
echo "><i>$theResult2[1]</i></td>";
}
echo "</tr></table>";
//
thanks in advance,
smirch