<? 
$c = $_POST['col'];
$r = $_POST['rw'];
?>
	
<? 
	for($cvchk = 1; $cchk<= $c; $cchk ++)
		{
			echo $cchk."<br>";
			
		for($rchk = 1; $rchk<= $r; $rchk ++)
				{ 
					echo $rchk." ";
				}
		}		
		
?>

i don't know what is wrong with this one
i want the output to become this one

1 2 3 4
2 3 4 1
3 4 1 2
4 1 2 3

i really kinda new with this thanks a lot guys

guys can you help me out with this one..

Your answer

<? 
$c = $_POST['col'];
$r = $_POST['rw'];
?>

<? 

for($cchk = 1; $cchk<= $c; $cchk ++)
{
	echo $cchk."";
	for($rchk = 1; $rchk<= $r; $rchk ++)	{ 
	
	
		if ($rchk  > $cchk){			echo $rchk;		}

	
	
	}
	for($rchk = 1; $rchk<= $r; $rchk ++)
	{ 
		if ($rchk  < $cchk){			echo $rchk;		}		
		
	}
	echo "<br> ";
	
	
}

?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.