ajoo Posted November 9, 2018 Share Posted November 9, 2018 (edited) Hi all ! I have the following code that works perfectly well. However I know that this is not the best way to code php and HTML together. I really want to clean up this code and make it as clean as possible. I have no clue how to proceed. <?php echo "<table border=0 cellpadding=0 cellspacing=0 width=600pt style='border-collapse:collapse;table-layout:fixed;width:600pt'>"; if($selected === 'Zu'|| $selected === 'unZu') { $c = 0; $rowcnt = 0; for($rows=0; $rows<2; $rows++) { if($rows ===0) $p = $rows*$sl1; if($rows ===1) $p = $rows*$sl2; echo "<tr>"; for($j=0; $j<$colCount1; $j++) { if(($j+1+$rows*$colCount1)== $miss[$c]) { $c++; echo "<td class=sum_number style='background-color:pink;' > ".($j+1)."</td>"; }else { echo "<td class=sum_number >".($j+1)."</td>"; } } echo "</tr>"; for($i=0;$i<$sumlen[$rows];$i++) { echo "<tr>"; for($a=1; $a<=$colCount1; $a++) { echo "<td class=sum_1st_column_3 >"; if($pr[$rowcnt][$a]>0) echo " ".$pr[$rowcnt][$a]; else echo $pr[$rowcnt][$a]; echo "</td>"; } echo "</tr>"; $rowcnt += 1; } echo "<tr>"; for($j=0; $j<$colCount1; $j++) { echo "<td class=result > </td>"; } echo "</tr>"; echo "<tr>"; for($j=0; $j<$colCount1; $j++) { echo "<td class=space_between_rows ></td>"; } echo "</tr>"; } echo "</table>"; ?> Thanks all ! Edited November 9, 2018 by ajoo Quote Link to comment Share on other sites More sharing options...
Barand Posted November 9, 2018 Share Posted November 9, 2018 There is an example here Quote Link to comment Share on other sites More sharing options...
ajoo Posted November 9, 2018 Author Share Posted November 9, 2018 Thank you Guru Barand ! I'll look it up and revert. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.