title: PHP $_POST error
body: <p>I'm getting the following error with $_POST['str']:</p>
  
  <blockquote>
    <p>Notice: Undefined index: str in C:\Program Files\EasyPHP-5.3.8.0\www\strrev.php on line 12</p>
  </blockquote>
  
  <p>I spent too much time to find an answer for this but no luck! 
  Please take a look at the code and let me know what's wrong with it?</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;?php 
      if (trim($_POST['str'])) {
        $str = $_POST['str'];
    $len = strlen($str);
        for($i=($len-1); $i&gt;=0;$i--) {
        echo $str[$i];
        } 
  } else {
    ?&gt;
  &lt;form method="post" action=""&gt;
      &lt;input type="text" name="str" /&gt;
      &lt;input type="button" name="submit" value="Reverse" /&gt;
      &lt;/form&gt;
      &lt;?php
    }
    ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>It shows the text field and Reverse button beside the error.
  And also when I push the button nothing will happens.</p>