Sticky Data

I am having an issue with the data from page ID 5 not displaying in the form, Why?


<?php

ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);
include('includes/header.php');

include('includes/class/class.form.php');

include('includes/class/class.page.php');


$iPageID = 5; 

if(isset($_GET["PageID"])){
    
    $iPageID = $_GET["PageID"];
}

$EditedPage = new Page();

$EditedPage->loadPage(5);

$apageInformation = array(); // Information From DB Sticky
$apageInformation["name"] = $EditedPage->getPageName();
$apageInformation["content"] = $EditedPage->getPageContent();

print_r($EditedPage->getPageContent);


$formEdit = new Form('editpage.php?PageID=".$iPageID', 'EditPage','return CheckEditPage();','');

$formEdit->setStickyData($apageInformation);


if(isset($_POST["submit"])){
    
    $formEdit->setStickyData = $_POST;
    
    $formEdit->checkNotEmpty("Name");
    
    $formEdit->checkNotEmpty("PageContent");
    
    if($formEdit->getValid() == true){
        
            $EditedPage->setPageName = $database->escape_value($_POST["Name"]);
                
            $EditedPage->setPageContent = $database->escape_value($_POST["PageContent"]);
                
           $EditedPage->savePage();
        
        $Message = "Page Updated";
        
    }else{
        
        $Message = "You Have An Error Mate";
    }
}


$formEdit->openFieldset();
$formEdit->makeInputBox("Name","Name","CheckInput(this.id);");
$formEdit->makeTextArea("Content", "PageContent", "20","70", "CheckInput(this.id);");
$formEdit->makeSubmitButton("submit","Edit Page");
$formEdit->closeFieldset();

exit;

$newNavigation = new Navigation();


?>

     <?php echo $newNavigation->mainMenu();?>

    <h1  class="Heading">Edit Page</h1>

    <?php echo $Message ?>

   <?php echo $formEdit->getHTML(); ?> 

    <?php include('includes/footer.php')?>


Errors

Notice: Undefined variable: aImage in /home/public_html/Nyken/Admin/includes/class/class.page.php on line 27

Notice: Undefined property: Page::$getPageContent in /home/public_html/Nyken/Admin/editpage.php on line 27

Notice: Undefined index: Name in /home/public_html/Nyken/Admin/includes/class/class.form.php on line 41

Notice: Undefined index: Name in /home/public_html/Nyken/Admin/includes/class/class.form.php on line 42

Notice: Undefined index: PageContent in /home/public_html/Nyken/Admin/includes/class/class.form.php on line 68

Notice: Undefined index: PageContent in /home/public_html/Nyken/Admin/includes/class/class.form.php on line 69

Class - Page


<?php

require_once('../includes/database.php');

class Page{
    
    private $iID;
    
    private $sPageName;
    
    private $sPageContent;
    
    public function loadPage($iID){
        
        global $database;
        
        $Query = "SELECT * FROM Pages WHERE id =" .$iID;
        
        $resResult = $database->query($Query);
    
        //Fetch The Row
        
        $aPage = $database->fetch_array($resResult);
        
        $this->iID = $aPage["id"];
        $this->sPageName = $aPage["name"];
        $this->sPageContent= $aImage["content"]; // Was get maybe typo
        
        $this->bExisting = true;
    
    }
    
    public function savePage(){
        
        global $database;
        
        if($this->bExisting == false){
            
            $Query = "INSERT INTO Pages(id,name,content) VALUES ('".$this->iID."', '".$this->sPageName."','".$this->sPageContent."')";
            
            $bResult = $database->query($Query);
            
            if($bResult){
                
                $this->iID = $database->get_last_insert_id();
                
                $this->bExisting = true;
                
            }
            else{
                
                die("Save Failed");
            }
            
        }else{
            
            $Query = "UPDATE Pages SET name = '".$this->sPageName."', content = '".$this->sPageContent."' WHERE id =".$this->iID;
            
            echo $Query;
            $bResult = $database->query($Query);
            
        }
    }
        
                // Get Functions
        
    public function getPageID(){
            return $this->iID;
    }    
        
    public function getPageName(){
            return $this->sPageName;
    }
    
    public function getPageContent(){
            return $this->sPageContent;
    }
        
    // Set Functions
    
    public function setImageID($iID){
        
        global $database;
        
        $iID = $database->escape_value($iID);
        
        $this->iID = $iID;
    }    
        
      
    public function setPageName($sPageName){
        
        global $database;
        
        $sPageName = $database->escape_value($sPageName);
        
        $this->sPageName = $sPageName;
    }   
        
    public function setPageContent($sPageContent){
        
        global $database;
        
        $sPageContent = $database->escape_value($sPageContent);
        
        $this->sPageContent = $sPageContent;
    }
    
    
}


//Testing

//Save

//$newImageUpload = new Image();
//$newImageUpload->setImageID(8);
//$newImageUpload->setImageName("Image Class Works");
//$newImageUpload->setImagePath("Image Path Success");
//$newImageUpload->saveImage();



?>


Class-Form


<?php

require_once('../includes/database.php');


class Form{
    
    private $sHTML;
    private $aStickyData;
    private $aValidationError;
    
    public function __construct($sFormAction, $sID, $JS, $Enctype){
        
        $this->aStickyData = array();
        
        $this->aValidationError = array();
        
        $this->sHTML = "<form id='".$sID."' action='".$sFormAction."' method= 'post' onsubmit='".$JS."' enctype='".$Enctype."'>\
\
";
        
    }
    
    
    public function openFieldset(){
        
	$this->sHTML .= "<fieldset>\
\
"; //attr
    }
    
     public function closeFieldset(){
        
	$this->sHTML .= "</fieldset>\
\
";
    }
        
    public function makeLabel($sLabel, $sName){
        
	$this->sHTML .= "<label for='".$sName."'>".$sLabel.":</label>\
\
";
    }
    
    public function makeInputBox($sLabel,$sName,$JS){
        
        $this->makeLabel($sLabel,$sName);
        $this->sHTML .= "<input type='text' name='".$sName."' id='".$sName."' value='".$this->aStickyData[$sName]."' onblur='".$JS."'/>
                        <div class='Error' id='".$sName."Error'>".$this->aValidationError[$sName]."</div>\
\
";

    }
    

    public function makePasswordBox($sLabel,$sName){
        
        $this->makeLabel($sLabel,$sName);
        $this->sHTML .= "<input type='password' name='".$sName."' id='".$sName."' value='".$this->aStickyData[$sName]."'/>
                        <div class='Error' id='".$sName."Error'>".$this->aValidationError[$sName]."</div>\
\
";
    }
    
    public function makeUpLoadBox($sLabel, $sName){
		
		$this->makeLabel($sLabel, $sName);
		$this->sHTML .= "<input type='file' name='".$sName."' id='".$sName."'/>\
\
";
	}
	
	public function makeHiddenField($sName, $sValue){
		
		$this->sHTML .= "<input type='hidden' name='".$sName."' value='".$sValue."' />\
\
";
	}
	
    public function makeTextArea($sLabel,$sName,$Rows,$Cols, $JS){
        
        $this->makeLabel($sLabel,$sName);
        $this->sHTML .= "<textarea name='".$sName."' id='".$sName."' rows='".$Rows."' cols='".$Cols."' onblur='".$JS."'>". $this->aStickyData[$sName]."</textarea>
	    <div class='Error' id='".$sName."Error'>".$this->aValidationError[$sName]."</div>\
\
";
    }
    
    
    public function makeDropDownList($sLabel, $sName, $aOptions){
        $this->makeLabel($sLabel, $sName);
        $this->sHTML .= "<select name='".$sName."' id='".$sName."'>\
\
";
        
        //To contruct the option list
        foreach($aOptions as $key=>$value){
        
                $this->sHTML .= "<option value='".$key."'>".$value."</option>\
";
        }
                                                
        $this->sHTML .= "</select>
                                        <div id='Error'></div>";
	
    }
    
    public function makeRadioInput($sName, $sLabel, $aRadioOptions){	
		$this->sHtml .= "<label for='" .$sName."'>".$sLabel."</label>\
";
		
		foreach($aRadioOptions as $value => $text){
				
			if ($this->aStickyData[$sName] == $value){
				$this->sHtml .= "<input type='radio' name='".$sName."' value='".$value."' checked class='radio'/><div id='radioText'>".$text."</div>\
";
			}else{
				$this->sHtml .= "<input type='radio' name='".$sName."' value='".$value."' class='radio'/><div id='radioText'>".$text."</div>\
";
			}
		}
			$this->sHtml .= "<div id='Error'>".$this->aValidationError[$sName]."</div>";
	}
    
    public function makeCheckBox($sName, $sValue){
	
		if($this->aStickyData[$sName] == $sValue){
	
			$this->sHTML .= "<input type='checkbox' name='".$sName."' id='".$sName."' value='".$sValue."' checked='checked' /><p id='agreeTerm'>".$sValue."</p>\
";
		}	
		else{
		$this->sHTML .= "<input type='checkbox' name='".$sName."' id='".$sName."' value='".$sValue."' /><p id='agreeTerm'>".$sValue."</p>\
";
		}
    }
    
    	public function checkUpload($sName, $sMimeType, $iSize){
		
		$Message = "";
	
		if(empty($_FILES[$sName]["name"])){
			
			$Message = "No files specified";
			
		}elseif($_FILES[$sName]['error'] != UPLOAD_ERR_OK){
				
			$Message = "File cannot be uploaded";
				
		}elseif($_FILES[$sName]["type"] != $sMimeType){
					
			$Message = "Only ".  $sMimeType ." format can be uploaded";
					
		}elseif($_FILES["sName"]["size"] > $iSize){
			
			$Message = "Files cannot exceed ".$iSize." bytes in size";
			
		}
		
		//if there is any error, Assign error message to aValidationError 
		if ($Message != ""){
			$this->aValidationError[$sName] = $Message;
		}
	}
		
	
	public function Upload($sName, $sNewFileName){
		
		$newname = dirname(__FILE__).'../images/Gallery/'.$sNewFileName;
		
		move_uploaded_file($_FILES[$sName]['tmp_name'],$newname);
    	}
    
    public function checkNotEmpty($sName){
	
	if(strlen($this->aStickyData[$sName]) == 0)
	
	$this->aValidationError[$sName] = "* Required";
    }
    
        
    public function makeLinkButton($sName, $Value){
	
	$this->sHTML .= "<a href='".$sName.".php'>"."<input name='".$sName."' id = '".$sName."' type='button' value=".$Value." />"."</a>";
	
    }  
    

    public function makeSubmitButton($sName, $Value){
	
	$this->sHTML .= "<input name='".$sName."' id = '".$sName."' type='submit' value='".$Value."' />\
\
";
	
    }
    
    public function makeResetButton($sName, $Value){
	
	$this->sHTML .= "<input name='".$sName."' id = '".$sName."' type='reset' value='".$Value."' />";
	
    } 

    public function getHTML(){
        
        $this->sHTML .="</form>";
        return $this->sHTML;
    }
    
    public function getValid(){
	
	if (count($this->aValidationError) == 0){
	    
	    return true;
	
	}else{
	    
	    return false;
	}
    }
    
    
    public function setStickyData($aData){
        
        $this->aStickyData = $aData;
    }
    
    
    
}



?>