addElement('header', null, 'Send a comment or an inquiry'); $form->addElement('text', 'name', 'Your Name:', array('size' => 30, 'maxlength' => 60)); $form->addElement('text', 'email', 'Your E-mail Address:', array('size' => 30, 'maxlength' => 60)); $form->addElement('text', 'subject', 'Subject:', array('size' => 30, 'maxlength' => 80)); $form->addElement('checkbox','join','','Please send information about joining the Friends'); $form->addElement('textarea', 'comments', 'Comment or Inquiry:', array('cols' => 50, 'rows' => 5)); $tm =& HTML_QuickForm::createElement('submit',null,'Send Comment or Inquiry'); $grp[] = $tm; $tm =& HTML_QuickForm::createElement('reset',null,'Clear Form'); $grp[] = $tm; $form->addGroup($grp, 'buttons', ' '); // Define filters and validation rules $form->applyFilter('name', 'trim'); $form->addRule('name', 'Please enter your name.', 'required', null, 'server'); $form->addRule('email', 'Please enter your complete valid email address.', 'required'); $form->addRule('email', 'Please enter your complete valid email address.', 'email'); // Try to validate a form if ($form->validate()) { $form->freeze(); $form->process('process_form', false); #mail('abarrera@princeton.edu','test','test'); echo "
Thank You, ".$form->exportValue('name')."
Your comment/inquiry was submitted, and we will respond shortly.
";
} else {
$renderer =& new HTML_QuickForm_Renderer_Default(true);
$renderer->setElementTemplate("\n\t\n\t\t{element}
\n\t\t{element}
\n\t\t{element}
\n\t\t{element}
\n\t\t{element}
\r\n"; if ($values['join']=='1') { $omsg .= "Please send information about joining the friends.
\r\n"; } $omsg .= 'Comments: ' . htmlspecialchars($values['comments']) . "
\r\n"; mail('abarrera@princeton.edu','Friends Comment:'.htmlspecialchars($values['subject']) . ' ', $omsg, $headers); } ?>