<?php
     session_start();
	 $n = $_GET["n"];
	 if ($n <0 or $n>9)
		 header("Location: tb.php?n=$n");
	else
	 {
		$tabuada = "<h1>Tabuada dos $n</h1>" ;
		$tabuada = $tabuada . "<pre>" ;
		
		for($i=1; $i<=10; $i++)	
		{
			$result= $n * $i;
			$tabuada = $tabuada . "$n x $i = $result <br>";
		}
		
		$tabuada= $tabuada . "</pre>";
		
		$_SESSION['tabuada'] = $tabuada;
		
		header("Location: tb.php");
	 }
?>