PHP error: Undefined index: submit
<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>In this once the submit button is clicked it retrieve the data from database. But once i enter this page  <strong>Undefined index: submit</strong> is shown before i click the submit button.</p>

<pre><code>&lt;div id="title"&gt;
    &lt;form method="get" action="&lt;?php echo $_SERVER['PHP_SELF']?&gt;"&gt;
        &lt;h3&gt;Select your product and click submit&lt;/h3&gt;&lt;br /&gt;
        &lt;select name="prod"&gt;
            &lt;option value="default"&gt;Select your product&lt;/option&gt;
            &lt;option value="os"&gt;Operating Systems&lt;/option&gt;
            &lt;option value="mobile"&gt;Smart Mobiles&lt;/option&gt;
            &lt;option value="mobile"&gt;Computers&lt;/option&gt;
            &lt;option value="shirt"&gt;Shirts&lt;/option&gt;
        &lt;/select&gt;&lt;br /&gt;&lt;br /&gt;
        &lt;input type="submit" value="Submit" name="submit"/&gt;
    &lt;/form&gt;
</code></pre>

<p>The php code is:</p>

<pre><code>&lt;?php
    $submitcheck=$_GET['submit'];
    echo $submitcheck;
    if (!isset($submitcheck)) {
        echo 'Pls select and submit';
    } else {
        ....
    }
</code></pre>

<p>?></p>
