Undefined Index in php (I've searched all over internet, and stackoverflow, tried almost everything)
<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><code>enter code here</code>this is php code</p>

<pre><code>$choice_spc_port = $_POST["txtSpace"];  (THIS LINE GIVES UNDEFINED INDEX NOTICE)
$choice_loc = $_POST["txtLocation"]; (THIS LINE GIVES UNDEFINED INDEX NOTICE)
</code></pre>

<p>And this is HTML Form</p>

<pre><code>&lt;form id="animalform" name="animalform" method="post" action="animalform.php"&gt;
&lt;div  class="wrapper"&gt; &lt;strong&gt;&lt;span&gt;*&lt;/span&gt; Text Space portion:&lt;/strong&gt;
            &lt;div class="formText"&gt;
              &lt;input type="radio" name="txtSpace" value="HR"/&gt;Text space for Horse.&lt;br /&gt;
      &lt;input type="radio" name="txtSpace" value="ZB"/&gt;Text Space For Zebra&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div class="wrapper"&gt; &lt;strong&gt;&lt;span&gt;*&lt;/span&gt; Animal Location:&lt;/strong&gt;
                &lt;div class="formText"&gt;
                &lt;input type="radio" name="txtLocation" value="txtSetXY"/&gt; Specify Animal Location&lt;br /&gt;
                    &lt;div style="padding-left:20px;"&gt;
                    X: &lt;input type="text" id="locField" name="txtXLocation"&gt;  &lt;span&gt;Taking (x=1,y=1) top left box. Increment +1 in value of X moving right&lt;/span&gt;&lt;br /&gt;
                    Y: &lt;input type="text" id="locField" name="txtYLocation"&gt;  &lt;span&gt;Taking (x=1,y=1) top left box. Increment +1 in value of Y moving downwards&lt;/span&gt;&lt;br /&gt;
                    &lt;/div&gt;
                    &lt;input type="radio" name="txtLocation" value="Default"/&gt;Default
                &lt;/div&gt;

            &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>Query to insert in database</p>

<pre><code>$insert = "INSERT INTO dbForm (db_space_portion, db_animal_location) VALUES ('{$choice_spc_port}', '{$choice_loc}')";
</code></pre>

<p>I tried the same in firefox and those two lines give notice as mentioned in bracket. Also on internet many people are looking for solution. So I think this question will help many out there.</p>
