Generating tables of numbers in PHP
Already gave in the wrong placed question, anyway here is my solution: codepad.viper-7.com/zTLliA
Copy&amp;paste is never a good idea.
if (isset($_POST['number']) &amp;&amp; is_numeric($_POST['number']) &amp;&amp; (($_POST['number'] &gt; 0) &amp;&amp; ($_POST['number'] &lt;= 20))) { 
    $number = $_POST['number'];
    for ( $counter = 1 ; $counter &lt;=10; $counter++ ) {
        $temp = $number * $counter ;
        echo &quot;$number x $counter = $temp&lt;br /&gt;&quot;; 
    }
} else {
    echo &quot;Please enter a number between 1 and 20&quot;; 
}

A single for is enough. In the if statement we check if the $_POST['number'] exists, if it's actually a number and if it is between 1 and 20.