When I try to submit a form on my site I get the following error:
Fatal error: Cannot access empty property in functions/form_validation.php on line 15
The code for form validation is:
class Validation {
var $success;
var $post_data;
var $errors;
var $delimiter;
function Validation($HTTP_POST_DATA) {
$this->success = true;
$this->errors = false;
$this->$post_data = $HTTP_POST_DATA;
$this->delimiter = "|";
while(list ($key, $val) = each ($this->$post_data)) {
$this->{$key} = $val;
}
reset($this->$post_data);
while(list ($key, $val) = each ($this->$post_data)) {
if(method_exists($this, $key)) {
$cmd = "\$this->".$key."();";
eval($cmd);
}
}
}
The code from the form page is:
include_once($APP_ROOT . "functions/index.php");
include_once($APP_ROOT . "functions/form_validation.php");
$CONTINUE = TRUE;
$valid = new Validation($_POST);
if($CONTINUE = $valid->success) {
This code used to work just fine before we upgraded to PHP5. Any idea what I need to change to get it working again?
Thanks
$this->$post_data
should be $this->post_data
In future, try looking at the line that the error message points you do, because usually that's where the problem is! ;)
Change this:
$this->$post_data = $HTTP_POST_DATA;
To this:
$this->post_data = $HTTP_POST_DATA;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With