OK. I finally got my zend form working, validating, filtering and sending the contents to my process page (by using $form->populate($formData);
)
Now, how do I email myself the contents of a form when submitted? Is this a part of Zend_form or some 开发者_开发百科other area I need to be looking in?
Thanks!
You can use Zend Mail for this, Zend form does not offer such functions.. but its an nice idea.
In your controleller, after $form->isValid();
if ($form->isValid($_POST)) {
$mail = new Zend_Mail();
$values = $form->getValues();
$mailText = 'My form valueS: ';
foreach ($values as $v) {
$mailText .= 'Value ' . $v . PHP_EOL;
}
$mail->setFrom('user@user.de', 'user');
$mail->AddTo('Me@me.de', 'me');
$mail->setSubject->$form->getName();
$mail->send();
} else {
// what ever
}
精彩评论