email()->validate('user-email'); // check for errors if ($validator->hasErrors()) { $_SESSION['errors']['special-offer-sign-up'] = $validator->getAllErrors(); } else { /* Database insert (disabled for demo) */ /*require_once rtrim($_SERVER['DOCUMENT_ROOT'], DIRECTORY_SEPARATOR) . '/phpformbuilder/database/db-connect.php'; require_once rtrim($_SERVER['DOCUMENT_ROOT'], DIRECTORY_SEPARATOR) . '/phpformbuilder/database/Mysql.php'; $db = new Mysql(); $insert['ID'] = Mysql::SQLValue(''); $insert['user_first_name'] = Mysql::SQLValue($_POST['user-first-name']); $insert['user_name'] = Mysql::SQLValue($_POST['user-name']); $insert['user_email'] = Mysql::SQLValue($_POST['user-email']); if (!$db->insertRow('YOUR_TABLE', $insert)) { $user_message = '

' . $db->error() . '
' . $db->getLastSql() . '

' . "\n"; } else { $user_message = '

Thanks for suscribe !

' . "\n"; Form::clear('special-offer-sign-up'); }*/ Form::clear('special-offer-sign-up'); // just for demo ; delete this line if real database recording. $user_message = '

Thanks for signing up !

' . "\n"; // just for demo ; delete this line if real database recording. } } /* ================================================== The Form ================================================== */ $form = new Form('special-offer-sign-up', 'horizontal', 'novalidate', 'foundation'); // $form->setMode('development'); $form->setCols(0, 6); $form->addHtml('

Special Offer Sign Up
Enter your Name and Email to get Special Deals

'); $form->addHtml(''); $form->groupInputs('user-first-name', 'user-name'); $form->addIcon('user-first-name', '', 'before'); $form->addHelper('First Name', 'user-first-name'); $form->addInput('text', 'user-first-name', '', '', 'class=input-group-field, required'); $form->addHelper('Last Name', 'user-name'); $form->addInput('text', 'user-name', '', '', 'required'); $form->addHtml(''); $form->setCols(0, 12); $form->addIcon('user-email', '', 'before'); $form->addInput('email', 'user-email', '', '', 'class=input-group-field, required'); $form->setCols(-1, -1); $form->centerButtons(true); $form->addBtn('submit', 'submit-btn', 1, 'Sign Up ', 'class=button primary'); // jQuery validation $form->addPlugin('formvalidation', '#special-offer-sign-up'); ?> Foundation Special Offer Sign Up Form - How to create PHP forms easily printIncludes('css'); ?>

Php Form Builder - Special Offer Sign Up Form
vertical form with helpers

render(); ?>
printIncludes('js'); $form->printJsCode(); ?>