What is the difference between if ($this-> _hasParam('name') and if($this->_getParam('name')), Ze
- by Linto davis
I want to check in zend, whether a posted form value 'name' contains a value.For this i have used the following code
one method
if ($this->_getPatram('name') != null ) {
echo 'field name contains value';
} else {
echo 'field name contains no value';
}
second method
if ($this->_hasParam('name')) {
echo 'field name contains value';
} else {
echo 'field name contains no value';
}
output , when submitting the form with the 'name' field contains no value
in first method
field name contains no value (result is correct)
in second method
field name contains value (result is wrong)
So what is the difference between these two ? _hasParam and _getParam