Undefined index: name when processing a form within a class
<p>I am having an issue when processing form data. When the form is submitted, an object from the sign_up class is created and the $_POST array is validated within this class. Various 'if' statement checks are then carried out to filter out unwanted chars, if the result does not equal '0', then a message is added to an array, please see an extract below</p>

<pre><code>    &lt;?php
    include('super_class.php');

    class Signup_User extends Super_Class {
          protected $errors = array();

     public function processUserInput() {

          if($_SERVER['REQUEST_METHOD']=='POST') {

                if(0 == preg_match("/\S+/",$name = $_POST['name'])) {
                     $this-&gt;errors['name'] = "Please enter your first name.";
          }
</code></pre>

<p>The form has php code, which execute the following, when a field has not been filled in, etc</p>

<pre><code>    &lt;?php if(isset($_POST['name'])) { echo $sign_up-&gt;getError('name');}?&gt;   
</code></pre>

<p>The getError code in the sign_up class object.</p>

<pre><code>    public function getError($name) {

    if($this-&gt;errors[$name]) {
        return $this-&gt;errors[$name];
    }
}
</code></pre>

<p>If I load the form and just press 'submit' all errors print out next to the input fields as intended, however if I enter some text into the name input box for example, I get the following error: "Notice: undefined index name" , and points to the getError function?</p>

<p>I thought I may need to define the $_POST array into varibles first and then check them, but the result was still the same.</p>

<p>Hope someone can help, I have been going round in circles on this one!! </p>
