setSubmitButton('Send');
$form->setupDatabase('localhost','carolinabeachdata','capefearforms','!cape!fear!','fish_story_submission');
$form->setupEmail('systems@capefearcoast.com','systems@capefearcoast.com','Fish Story Submission', true);
// When completed, redirect the user or say a message?
//$form->setRedirect('/fishing-center/thankyou_fish-story.html');
$form->setThankYouText('Thank you for your submission!');
$form->setupFileUpload(2048, '/usr/local/jakarta-tomcat/webapps/cms_resources/www.carolinabeachgetaway.com/images/fishing-center/submissions/');
// Optional - add the current date/time to the database row
$form->addDateColumn('SubmissionDate');
// Spam protection
$form->addField(array(
'name' => 'second',
'type' => 'text',
'label' => 'Leave this box blank!',
'validate' => 'blank',
'defaultValue' => '',
'errorMessage' => 'Please do not enter anything where the form says, "Leave this box blank!"'
));
$form->addField(array(
'name' => 'subject',
'type' => 'hidden',
'defaultValue' => 'Carolina Beach - Fish Story Submission'
));
$form->addField(array(
'name' => 'image_upload',
'label' => 'Please attach your fish image here.
(2MB Limit)',
'type' => 'file',
'columnName' => 'FileName',
));
$form->addField(array(
'name' => 'name',
'label' => '*Name:',
'type' => 'text',
'errorMessage' => 'Please enter your name.',
'required' => true,
'defaultValue' => '',
'columnName' => 'Name'
));
$form->addField(array(
'name' => 'email',
'type' => 'text',
'label' => '*Email:',
'errorMessage' => 'Please enter a valid email address',
'required' => true,
'validate' => 'email',
'columnName' => 'Email'
));
$form->addField(array(
'name' => 'type_of_fish',
'label' => '*Type of Fish:',
'type' => 'text',
'errorMessage' => 'Please enter the type of fish you caught.',
'required' => true,
'defaultValue' => '',
'columnName' => 'Type'
));
$form->addField(array(
'name' => 'weight',
'label' => '*Weight:',
'type' => 'text',
'errorMessage' => 'Please enter the weight of the fish you caught.',
'required' => true,
'defaultValue' => '',
'columnName' => 'Weight'
));
$form->addField(array(
'name' => 'catch_date',
'label' => '*Catch Date:',
'type' => 'text',
'errorMessage' => 'Please enter the catch date.',
'required' => true,
'defaultValue' => '',
'columnName' => 'CatchDate'
));
$form->init();
// Load the CMS Template
define('TEMP_DIR', realpath('../../phpapps/tmp/') . '/');
$loader = new CMS_Template_Loader('fishstory', 'http://' . $_SERVER['HTTP_HOST'] . '/fishing-center/_fish_story', 1800);
$loader->set('', '=$content ?>');
$loader->load();
$tpl =& new Template(TEMP_DIR);
$tpl->set('content', $form->getDisplayString());
echo $tpl->display('_cms_template_fishstory.tpl.php');
?>