You are here: OO email-class « All PHP « IT news, forums, messages
OO email-class

Posted by Siv Hansen on 09/28/05 21:29

I'm trying to implement an OO-email class. Most of the methods are okay but
one... The one that checks user input.

I've made a function, boolean checkInput(array $input), but I don't know how
to check all array-indexes. I've tried a for-loop, array_search (search for
'', wich I interpret as an empty string), in_array('' - same empty string)
Neither of them pass. The array is deliberately filled out with zero(or
null)-values, but no error message occur (Neither does the success-message)

My code is like this: - from the email class
function checkInput($input){
if(array_search('', $input)){
$this->setError("All the fields must be filled out");
return false;
}
return true;
}

from the main of the script:
$arr=array($sender_name, $sender_email, $subject, $message);

print($myEmail->checkInput($arr));
if($myEmail->checkInput($arr)){
$myEmail->setParam('receiver', 'myEmail@domain.com');
$myEmail -> setParam('sender_email', $sender_email );
$myEmail -> setParam('sender_name', $sender_name);
$myEmail -> setParam('subject', $subject);
$myEmail -> setParam('message', $message);

if($myEmail ->send_email()){
print($myEmail->getMessage()."<br />\n");
print $myEmail->message();
}else{
$myEmail->getError();
}
}else{
$myEmail->getError();
}
}

As you can see, the array $arr contains four indexes, but I'm not able to
check for empty strings (or null-values)

How do I solve this?

Thanks in advance

Siv Hansen

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация