I want to make an array that will contain error strings so that I can output them if their is an error on the form.
But I keep getting this error Cannot use [] for reading in anyone know how to make an array for this kind of thing?
This is a snippet of my code:
class users {
...
public $errors = array();
//VALIDATE THE USERS INFO
function setError($error) {
$this->errors = $error[];
}
//check the passwords match
function checkPasswords($pass1, $pass2){
if($pass1 !== $pass2) {
setError("Your passwords dont match");
} else {
$this->password = $pass1;
}
}
}