hi heres my attempted code, the first while statement works for the rows(works for the weights0, but i cant get it to work with the columns(heights). it works so if min_height input value is 20 and max_height is 50 the columns would look like this 20 25 30 35 40 45 50. my code currently works for the rows but not columns, can anyone help?
<?php
$rowiStep = 5;
$coliStep = 5;
// Get these
$iweightMin = $_GET["min_weight"];
$iweightMax = $_GET["max_weight"];
$iheightMin = $_GET["max_height"];
$iheightmax = $_GET["min_height"];
$iCur = $iweightMin;
$iCol = $iheightMin;
print('<table class="table">');
print('<tr ><td>Height/</br>Weight</td>');
while ($iCur <= $iweightMax) {
printf('<tr><td>%d</td></tr>', $iCur);
$iCur += $rowiStep;
}
$rowiCol = $iheightMin;
while ($iCol <= $iheightmax) {
printf('<tr><td></td>', $iCol);
$iCol += $rowiCol;
}
print ('</tr>');
print('</table>');
?>
If you're looking to print a height/weight matrix; try this:
$rowiStep = 5;
$coliStep = 5;
$output = array(
'<table>'
);
for( $row_val = $_GET['min_weight'], $row_max <= $_GET['max_weight'];
$row_val < $row_max;
$row_val += $rowistep )
{
$output[] = '<tr><td>' . $row_val . '</td>';
for( $col_val = $_GET['min_height'], $col_val <= $_GET['max_height'];
$col_val < $col_max;
$col_val += $colistep )
{
$output[] = '<td>' . $col_val . '</td>';
}
$output[] = '</tr>';
}
$output[] = '</table>';
echo implode( "
", $output );
This will produce output like this:
|min_weight |min_height|min_height+colIStep|min_height+2colIstep|...|
|min_weight + rowIstep |min_height|min_height+colIStep|min_height+2colIstep|...|
|min_weight + 2rowIstep|min_height|min_height+colIStep|min_height+2colIstep|...|
|...|
What output are you looking for?