PHP Classes

PHP Bootstrap Form Builder: Compose, validate and display forms with Bootstrap

Recommend this page to a friend!
  Info   View files Example   Demos   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 65%Total: 877 This week: 1All time: 4,011 This week: 571Up
Version License PHP version Categories
form-example 1.0Freeware5.4HTML, PHP 5, Templates, Validation
Description 

Author

This class can compose, validate and display forms with Bootstrap.

It can compose and display forms with common fields using Bootstrap to render the forms using a given template in HTML.

The class can also validate the submitted form values according to given validation rules.

Currently it can validate each form input value as digit, as decimal, as upper and lower alphabetic text, alpha-numeric text, email address, IP address, url, hexadecimal text, float value, a login name, mac address, credit card, safe text, english text, image file, value smaller, larger or equal to a value, non-empty text, date, and matching a regular expression.

Picture of Vishv Sahdev
  Performance   Level  
Name: Vishv Sahdev <contact>
Classes: 13 packages by
Country: India India
Age: 52
All time rank: 51530 in India India
Week rank: 103 Up8 in India India Up
Innovation award
Innovation award
Nominee: 7x

Example

<?
/*
Author : Vishv sahdev
Email : vishv23@gmail.com
Website : v23.in
Date : 14 Dec. 2015
*/

include 'formClass.php';
$o=new bootstrapformClass;
if(isset(
$_GET['q']) && $_GET['q'] == 'newmember')
{
// "gt:3|alpha|url|email" ....
$datain=array("pid"=>"digit","name"=>"gt:3|digit");
    if(
$r=$o->_findValid($datain,$_POST)){
   
$op['maincontent'] = '<div class="alert alert-danger" role="alert">'.$r.'</div>' . newMember($o,$_POST);
    }
    else{
   
$op['maincontent'] = '<div class="alert alert-success" role="alert">Success..</div>';
    }
}
else
$op['maincontent'] = newMember($o);



//--- template ---------
if(is_file("./template/form-template.html")){
            echo
$o->render_temp("./template/form-template.html",$op);
    }

   
   
//------------------------------------------------------------------------------
// $o = $o=new formclass
// $p = $_POST //

function newMember($o,$p='')
    {
    if(!
is_array($p))
   
$p=array();
   
$ar=array("pid"=>'',"name"=>'',"checkbox"=>'',"radio"=>'',"select"=>'');
   
$ar=$o->_dataTransfer($ar,$p);
   
   
$r=$o->formStart("?q=newmember");
   
$r .= $o->hiddenField("newMember","ok");
   
$r .= $o->textField('Text','pid',$ar['pid']);
   
$r .= $o->textareaField('TextArea','name',$ar['name']);
   
$r .= $o->checkboxField('Checkbox','checkbox',$ar['checkbox']);
   
$r .= $o->radioField('Radio','radio','Option1',$ar['radio']);
   
$r .= $o->radioField('Radio2','radio','Option2',$ar['radio']);
   
$r .= $o->selectField('Select','select',$o->country(),$ar['select'] );
   
$r .= $o->buttonField('Submit','primary');
   
$r .= $o->formEnd();
    return
$r;
    }


  bootstrapFormClassExternal page  

Open in a separate window

  Files folder image Files  
File Role Description
Files folder imagetemplate (1 file)
Plain text file form-example.php Example example file
Plain text file formClass.php Class class file
Plain text file readme.txt Data example

  Files folder image Files  /  template  
File Role Description
  Plain text file form-template.html Data template

 Version Control Unique User Downloads Download Rankings  
 0%
Total:877
This week:1
All time:4,011
This week:571Up
User Ratings User Comments (1)
 All time
Utility:93%StarStarStarStarStar
Consistency:93%StarStarStarStarStar
Documentation:-
Examples:93%StarStarStarStarStar
Tests:-
Videos:-
Overall:65%StarStarStarStar
Rank:606