views:

14

answers:

1

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!

A: 

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('[email protected]', 'user');
 $mail->AddTo('[email protected]', 'me');
 $mail->setSubject->$form->getName();
 $mail->send();
} else {
    // what ever
}
ArneRie