OO email-class
- From: "Siv Hansen" <sivh@xxxxxxxxxxxx>
- Date: Wed, 28 Sep 2005 20:29:48 +0200
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@xxxxxxxxxx');
$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
.
- Follow-Ups:
- Re: OO email-class
- From: Janwillem Borleffs
- Re: OO email-class
- From: Zeljko A.
- Re: OO email-class
- Prev by Date: Re: libmysqlclient : compiler can not find ?
- Next by Date: affiche d'une nouvelle page .php ou .html sans l'entete
- Previous by thread: Re: Advanced HTML_QuickForm Question
- Next by thread: Re: OO email-class
- Index(es):
Relevant Pages
|