1778 Posts in 581 Topics by 555 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1197 Views |
-
send form

29 December 2008 at 11:27am Last edited: 29 December 2008 11:28am
hi
how to send the form ?
i haveclass TourPage_Controller extends Page_Controller {
...function MyForm() {
// Create fields
$fields = new FieldSet(
new TextField('FirstName', 'First name'),
new EmailField('Email', 'Email addres')
);function forTemplate() {
return $this->renderWith(array(
$this->class,
'Form'
));
}// Create actions
$actions = new FieldSet(
new FormAction('doMyForm', 'Send')
);return new Form($this, 'MyForm', $fields, $actions);
}function doMyForm($data, $form) {
$email = new Email_Template(
$data['Email'],
'my@gmail.com',
'good work'
);
$email->ss_template = 'MyForm';
$email->populateTemplate(array (
'Name' => $data['FirstName'],
'Email' => $data['Email'],
));
$email->send();
}...
}but it doesn't work
i have MyForm.ss in templates/email but i don't know what it should contains
could you give me some example code for my form which i should put into MyForm.ss ? -
Re: send form

29 December 2008 at 12:55pm
To make things easier on yourself you can just do $email->populateTemplate($data);
Then, all the keys of the $data array are available on your template. For instance, if you had a textfield with the name 'Name', you could call $Name on your template.
-
Re: send form

31 December 2008 at 1:06pm
nothing
i think that this
$actions = new FieldSet(
new FormAction('doMyForm', 'Send')
);doesn't work
i put the basic code in doMyForm function like this
function MyForm() {
echo "hello";
}and nothing happends
i get the blank sitei tried with phpmailer
it works but only if i put the code outside form the classclass TourPage extends Page {
...
}class TourPage_Controller extends Page_Controller {
...
}require("class.phpmailer.php");
$mail = new PHPMailer();
...
| 1197 Views | ||
|
Page:
1
|
Go to Top |

