3070 Posts in 869 Topics by 651 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 928 Views |
-
Form submission: Automatic blank page created in admin

4 November 2009 at 2:45am Last edited: 4 November 2009 6:52pm
i have created form submission page like "contact page" please find the code below. while i submit form it automatically one blank page created in admin sitetree. i have no luck to find the error, big strange for me. any help me to find this solution it very useful to me
<?php
/**
* Defines the ContactPage page type
*/class ContactPage extends Page {
static $db = array(
'FirstName' => 'Varchar(100)', //
'Surname' => 'Varchar(100)',
'Email' => 'Varchar(100)' //Text presented after submitting message
);
static $has_one = array(
);}
class ContactPage_Controller extends Page_Controller {
function Form() {
return new Form($this, "Form", new FieldSet(
// List 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("SignupAction", "Sign up")
), new RequiredFields(
// List the required fields here: "Email", "FirstName"
));
}function SignupAction($data, $form) {
// Create a new Contact and load the form data into it
$Contact = new ContactPage();
$form->saveInto($Contact);// Write it to the database. This needs to happen before we add it to a group
$Contact->write();
}
}
?>Regards,
thisIsRam
| 928 Views | ||
|
Page:
1
|
Go to Top |

