EDIT: Link to my first question. Might clear some things up. PHP Get corresponding data, with default and error handling
I have a function that checks if a GET statement exists. If so, it passes the value to a other function that then selects a class based on the value of the GET statement.
explaining:
The url = Page=Contact
The GetFormVariable approves it, and the class Contact is selected and it will give back a string. This string is used as an object 'Content' that, as it says, creats the content of the page.
public function getFormVariable($value){
switch (strtoupper($_SERVER['REQUEST_METHOD'])) {
case 'GET':
if (isset($_GET[$value]) && $_GET[$value] != NULL) {
return $_GET[$value];
}
else{
return false;
}
break;
case 'POST':
if (isset($POST[$value]) && $POST[$value] != NULL) {
return $POST[$value];
}
else{
return false;
}
break;
default:
return false;
}
}
Now the question. When there is no GET statement in the url. The GetFormVariable returns false. And this means there is nothing shown.
How do i give this constructor.
public function SetProperty ($prob, $val){
$this->$prob = $val;
}
The information to create the ContentHome.
SetProperty('Content', 'ContentHome');
Sorry for poor explanation, if anything is unclear please tell me so.