Howdy
I've got the following code for my custom form but it is just sending an empty e-mail;
<?php
class EmailForm_Controller extends Page_Controller {
function SignupForm() {
return new Form($this, "SignupForm", new FieldSet(
// List the your fields here
new TextField("FirstName", "First name"),
new TextField("Surname"),
new EmailField("Email", "Email address")
), new FieldSet(
// List the action buttons here
new FormAction("doform", "Sign up")
), new RequiredFields(
// List the required fields here: "Email", "FirstName"
));
}
function doform($data, $form) {
mail("james@gooduse.co.nz", "Comments", $form->$FirstName);
// Redirect to a page thanking people for registering
Director::redirect('thanks-for-registering/');
}
}
?>
At the moment you'll see I'm using $form->$FirstName as a test for the e-mail field but it's not working - what syntax should I be using?
Cheers
James