PHP OOP - Passing object to function is not working -


i have problem here on php oop. try in .net - pass whole object function. unfortunately, script didn't appear work , when try debug (using netbeans) stopped here:

$ud = new userdetails($fullname, $email, $contact, $username, $password, $password2);  

can tell me did wrongly? in advance!

my script:

<?php include 'class/registration.php';  $fullname = $_post['fullname']; $email = $_post['email']; $contact = $_post['contact']; $username = $_post['username'];  $password = $_post['password']; $password2 = $_post['password2'];  $ud = new userdetails($fullname, $email, $contact, $username, $password, $password2);  if (registration::checkemptyfield($ud)==true){         $error = "please don't leave field empty";     }  

userdetail class:

<?php class userdetails {  protected $_fullname; protected $_email;  protected $_contact;  protected $_username;    protected $_password;  protected $_password2;  public function __construct($fullname,$email,$contact,$username,$password,$password2) {        $this->_fullname = $fullname;         $this->_email = $email;       $this->_contact = $contact;       $this->_username = $username;       $this->_password = $password;       $this->_password2 = $password2;   }      public function get_fullname() {         return $this->_fullname;           }       public function get_email() {         return $this->_email;           }    public function get_contact() {         return $this->_contact;           }    public function get_username() {         return $this->_username;           }    public function get_password() {         return $this->_password;           }    public function get_password2() {         return $this->_password2;           }    } 

registration class:

<?php class registration {   function checkemptyfield(&$userdetails){          if ($userdetails-> get_fullname == ''){          return true;      }             elseif ($userdetails->get_email == ''){          return true;      }          elseif ($userdetails->get_contact == ''){          return true;      }          elseif ($userdetails->get_username == ''){          return true;      }          elseif ($userdetails->get_password == ''){          return true;      }          elseif ($userdetails->get_password2 == ''){          return true;      }     }   } 

you ask property, not method here: $userdetails-> get_fullname

correct way: $userdetails-> get_fullname()

you should turn on error reporting, because should have been reported php.


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -