<?php
if (isset ($_POST['signup'])){
	$email=$_POST['email'];
	$password=$_POST['password'];
	$username=$_POST['username'];
	$error='';
if(empty($username) or empty($email) or empty($password)){
	$error = 'all information are required';
	}
	 else {
	$email =  $getFromU->checkInput($email);
	$password =  $getFromU->checkInput($password);
	$username =  $getFromU->checkInput($username);
		
		if(!filter_var($email)){
	$error ='invalid email format';
		}
		else if(strlen($password)<5){
			$error='password is to short';
		}
		
		else{
			if($getFromU->checkEmail($email)===true){
				$error='email already exist';
			}
			else if(!empty($username)){
                if(strlen($username) > 20){
                    $error = "Username must be in between 6 to 20 characters";
                } 
                else if($getFromU->checkUsername($username) === true ){
                    $error = "username  already taken";
                }
			else{
				$getFromU->register($email,$username,$password);
			//$getFromU->create('users',array('email'=>$email,'password'=>md5($password),'username'=>$username,'profileImage' => 'images\defaultprofileimage.png'));
        $_SESSION['user_id'] = $user_id;
						header("location: home.php");					
							
					}
		}
				}
			}
		}
?>
public function register($email,$password,$username)
     {
         $stmt = $this->pdo->prepare("INSERT INTO `users` ( `email`,`password`, `username`,`profileImage`)
                          VALUES( :email, :password, :username,'images/defaultprofileimage.png') ");
         $stmt->bindParam(":email", $email, PDO::PARAM_STR);
         $stmt->bindParam(":password", md5($password), PDO::PARAM_STR);
         $stmt->bindParam(":username", $username, PDO::PARAM_STR);
        $stmt->execute();
         $user_id = $this->pdo->lastInsertId();
        $_SESSION['user_id'] = $user_id;
    }
error i having
      
    