PHP code example of formr / formr

1. Go to this page and download the library: Download formr/formr library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

formr / formr example snippets



$form = new Formr\Formr();


$form = new Formr\Formr();

$form = new Formr\Formr('bootstrap');

$form = new Formr\Formr('bulma');

$form = new Formr\Formr('bootstrap');
$form->create_form('Name, Email, Comments|textarea');

$form = new Formr\Formr('bootstrap');
$form->form_open();
$form->create('First name, Last name, Email address, Age|number, Comments|textarea');
$form->submit_button();
$form->form_close();

$form = new Formr\Formr();
$form->fastform('contact');

$data = [
    'text' => 'name, Name:',
    'email' => 'email, Email:',
    'checkbox' => 'agree, I Agree',
];

$form = new Formr\Formr('bootstrap');
$form->fastform($data);

$name = $form->post('name');
$email = $form->post('email');

$form->validate('Name, Email, Comments');

if($form->submitted()) {
    $data = $form->validate('Name, Email, Comments');
    $email = $data['email'];
}

$form->validate('Name(min[2]|max[30]), Email, Comments');

$email = $form->post('email');

$email = $form->post('email','Email','valid_email');

$email = $form->post('email','Email|Please enter a valid email address','valid_email');


// include the Formr class
se Bootstrap 4 as our form wrapper
$form = new Formr\Formr('bootstrap');

// make all fields as at least 10 characters
    $form->validate('Message(min[10])');

    // let's email the form
    $to = '[email protected]';
    $from = '[email protected]';
    $subject = 'Contact Form Submission';

    // this processes our form, cleans the input, and sends it as an HTML email
    if($form->send_email($to, $subject, 'POST', $from, 'HTML'))
    {
        // email sent; print a thank you message
        $form->success_message('Thank you for filling out our form!');
    }
}
html
<div class="my-wrapper-class">
     $form->text('name', 'Name');