PHP Error : Notice: Undefined variable
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index">PHP: “Notice: Undefined variable”  and “Notice: Undefined index”</a>  </p>
</blockquote>



<p>I want when I choose some value in a Select box to display a string for a number of times for example if I choosed the value 2 it will display a string twice.</p>

<p>this is the code I tried :</p>

<pre><code>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
&lt;head&gt;
&lt;script&gt;
function checkIt()
{
    var getNum = document.getElementById("numb").value;

    //this_file.php ... im specifying for just. you specify this full code in any of file and specify the whole url path
    location.href="this_file.php?countIt="+getNum;
}
&lt;/script&gt;
    &lt;style type="text/css"&gt;
    .centrer
    {
        position: absolute;
        left: 50%;
        top: 50%;
        font-size:24px;
    }
    &lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;
    &lt;select name="nombres" id="numb" onchange="checkIt();"&gt;
        &lt;option&gt;1&lt;/option&gt;
        &lt;option&gt;2&lt;/option&gt;
        &lt;option&gt;3&lt;/option&gt;
    &lt;/select&gt;

&lt;?php
if($_REQUEST["countIt"])
{
    $displayTimes = $_REQUEST["countIt"]; 
}
?&gt;
   &lt;div class="centrer"&gt;
    &lt;?php
        $s = "Hello World! &lt;br/&gt;";
        for($i=0; $i&lt;$displayTimes; $i++)
            echo $s;
    ?&gt;
    &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>but I have a problem : </p>

<blockquote>
  <p>Notice: Undefined variable: displayTimes in C:\Program
  Files\EasyPHP-12.1\www\site\Untitled-1.php on line 43</p>
</blockquote>

<p>notice that the line 43 is : <code>for($i=0; $i&lt;$displayTimes; $i++)</code></p>

<p>and also another problem that when I select the "1" Value it does anything, and also when I select other value the selected value in the select box still the value "1" and I have another question isn't there any other way to do this without using JS only by using PHP ?</p>
