Jump to content

insane code


ajoo

Recommended Posts

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 !

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.