This is the controller code as I have it:
<?php
class ContactController extends AppController
{
var $name = 'Contact';
var $uses = array('Contact');
var $components = array('Email','Output'); // uses Email and Output
components from rdOS
function index()
{
if(empty($this->data))
{
// no data has been passed to page from form
$this->render();
}
else
{
// data has been passed from form
// validate model using ->validates() not ->save()
if($this->Contact->set($this->data) && $this->Contact-
>validates()) // update to the original
{
// Validation passed
uses('Sanitize');
$this->data = Sanitize::cleanArray($this->data);
$defaultLayout = $this->layout;
$this->layout = 'email';
$this->Email->headers = "Content-type:
text/plain;
charset=iso-8859-1\n";
$this->Email->to = "[EMAIL PROTECTED]";
$this->Email->from =
$this->data['Contact']['name'].' <'.$this-
>data['Contact']['email'].'>';
$this->Email->subject = 'website contact';
$this->Email->thtml = 'email_layout';
$this->Email->controller = &$this;
$this->set('data',$this->data);
$this->Email->send();
$this->set('sent',1);
$this->render('index',$defaultLayout);
}
else
{
// Validation failed
$this->validateErrors($this->Contact); // for
triggering $html-
>tagErroMsg()
}
}
/*
$this->set('email', $this->data['User']['email']);
$this->set('password', $passwordOrig);
//Send email
*/
}
}
?>
On 13 mrt, 16:42, "Mariano Iglesias" <[EMAIL PROTECTED]>
wrote:
> Eventhough one calls the other, use cleanArray(), not cleanArrayr()
>
> Can you paste the code as you have it?
>
> -MI
>
> ---------------------------------------------------------------------------
>
> Remember, smart coders answer ten questions for every question they ask.
> So be smart, be cool, and share your knowledge.
>
> BAKE ON!
>
> blog:http://www.MarianoIglesias.com.ar
>
> -----Mensaje original-----
> De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
> de gerbenzomp
> Enviado el: Martes, 13 de Marzo de 2007 10:47 a.m.
> Para: Cake PHP
> Asunto: Re: email form
>
> Changed that, but get a fatal error:
>
> Fatal error: Call to undefined function: cleanarrayr()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---