what you have is good
lf you wanted to do it another way I feel that you'd be making you code convoluted.
here is what I came up with
PHP Code:
$vpArr = array(
array(20,'partno$x'),
array(100,'part$xdesc'),
array(6,'part$xqty'),
array(8,'part$xamount'),
);
function spitHTML($x,$vpArr){
$str = '<tr>';
foreach($vpArr as $k => $v){
$format = '<td><input type="text" maxlength="%s" name="%s" value="%s" /></td>';
$str .= sprintf($format, $v[0],$v[1],$v[1]);
}
$str = str_replace('$x', $x, $str);
return $str.'</tr>';
}
echo '<table>';
for ($x = 1; $x <= 8; $x++)
{
echo spitHTML($x,$vpArr);
}
echo '</table>';
Bookmarks