maxLength(100)->validate('message'); $validator->email()->validate('email'); // check for errors if ($validator->hasErrors()) { $_SESSION['errors']['order-form'] = $validator->getAllErrors(); } else { $email_config = array( 'sender_email' => 'contact@phpformbuilder.pro', 'sender_name' => 'Php Form Builder', 'recipient_email' => addslashes($_POST['email']), 'subject' => 'Php Form Builder - Order Form', 'filter_values' => 'order-form' ); $sent_message = Form::sendMail($email_config); Form::clear('order-form'); } } /* ================================================== The Form ================================================== */ $form = new Form('order-form', 'horizontal', 'novalidate'); // $form->setMode('development'); $form->setCols(0, 12); $form->startFieldset('Order Form'); $form->addHtml(''); $form->groupInputs('first-name', 'last-name'); $form->addHelper('First name', 'first-name'); $form->addInput('text', 'first-name', '', '', 'required'); $form->addHelper('Last name', 'last-name'); $form->addInput('text', 'last-name', '', '', 'required'); $form->addHtml('
'); $form->addHtml('
'); $form->addHtml(''); $form->addInput('email', 'email'); $form->addHtml(''); $form->setCols(0, 4); $form->groupInputs('area-code', 'phone-number'); $form->addHelper('Area Code', 'area-code'); $form->addInput('text', 'area-code', '', '', 'data-fv-regexp, data-fv-regexp-regexp=[+0-9-]+, data-fv-regexp-message=Please enter a valid Area Code'); $form->setCols(0, 8); $form->addHelper('Valid US Phone Number', 'phone-number'); $form->addInput('text', 'phone-number', '', '', 'data-fv-phone, data-fv-phone-country=US'); $form->addHtml('
'); $form->addHtml('
'); $form->addHtml(''); $form->setCols(0, 12); $form->addRadio('payment-method', 'credit card', 'credit-card'); $form->addRadio('payment-method', 'paypal', 'paypal'); $form->printRadioGroup('payment-method', '', false); $form->addHtml('
'); $form->addHtml('
'); $form->setCols(0, 2); $form->addHtml(''); $form->setCols(0, 12); $form->addHelper('Street Address', 'street-address'); $form->addInput('text', 'street-address', '', '', 'required'); $form->addHelper('Street Address Line 2', 'street-address-2'); $form->addInput('text', 'street-address-2'); $form->setCols(0, 6); $form->groupInputs('city', 'state'); $form->addHelper('City', 'city'); $form->addInput('text', 'city', '', '', 'required'); $form->addHelper('State / Province', 'state'); $form->addInput('text', 'state'); $form->groupInputs('zip-code', 'country'); $form->addHelper('Postal / Zip Code', 'zip-code'); $form->addInput('text', 'zip-code', '', '', 'required'); $form->addHelper('Country', 'country'); // preselect US if (!isset($_SESSION['order-form']['country'])) { $_SESSION['order-form']['country'] = 'US'; } $form->addCountrySelect('country', '', '', array('flag_size' => 32, 'return_value' => 'code', 'placeholder' => 'Select your country')); $form->setCols(0, 12); // Inverted Dependent field - if non-US selected $form->startDependentFields('country', 'US', true); $form->addHtml(''); $form->addTextarea('additional-informations'); $form->endDependentFields(); $form->setCols(4, 8); $form->addBtn('submit', 'submit-btn', 1, 'Proceed ', 'class=btn btn-success ladda-button, data-style=zoom-in'); $form->endFieldset(); // Custom radio & checkbox css $form->addPlugin('nice-check', 'form', 'default', ['%skin%' => 'red']); // jQuery validation $form->addPlugin('formvalidation', '#order-form'); ?> Bootstrap 4 Order Form - How to create PHP forms easily printIncludes('css'); ?>

Php Form Builder - Order Form
with Country select & helpers

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