PHP Form Builder Class / Examples / All Supported Form Elements

Version: Released:

All Supported Form Elements - This example demonstrates all 26 supported form element types: hidden, textbox, textarea, webeditor, password, file, date, daterange, expdate, state, country, yesno, truefalse, select, radio, checkbox, latlng, sort, checksort, captcha, slider, html, color, email, htmlexternal, button. More information on each of these form elements can be found in the Supported Form Elements section of the documentation.

  • Option #0
  • Option #1
  • Option #2
  •  
0
HTML:
External HTML:
Processing


Processing

<?php
$form 
= new form("formelements_0");
$form->setAttributes(array(
    
"width" => "400"
));    

if(!empty(
$_GET["errormsg_0"]))
    
$form->errorMsg filter_var(stripslashes($_GET["errormsg_0"]), FILTER_SANITIZE_SPECIAL_CHARS);

$form->addHidden("cmd""submit_0");
$form->addTextbox("Textbox:""MyTextbox");
$form->addTextarea("Textarea:""MyTextarea");
$form->addPassword("Password:""MyPassword");
$form->addFile("File:""MyFile");
$form->addDate("Date:""MyDate");
$form->addDateRange("Date Range:""MyDateRange");
$form->addExpDate("Expiration Date:""MyExpDate");
$form->addState("State:""MyState");
$form->addCountry("Country:""MyCountry");
$form->addYesNo("Yes/No:""MyYesNo");
$form->addTrueFalse("True/False:""MyTrueFalse");
$form->addSelect("Select Box:""MySelect""", array("Option #0""Option #1""Option #2"));
$form->addRadio("Radio Buttons:""MyRadio""", array("Option #0""Option #1""Option #2"));
$form->addCheckbox("Checkboxes:""MyCheckbox""", array("Option #0""Option #1""Option #2"));
$form->addLatLng("Latitude/Longitude:""MyLatitudeLongitude");
$form->addSort("Sort:""MySort", array("Option #0""Option #1""Option #2"));
$form->addCheckSort("Checksort:""MyChecksort""", array("Option #0""Option #1""Option #2"));
$form->addCaptcha("Captcha:");
$form->addSlider("Slider:""MySlider");
$form->addHTML("HTML:");
$form->addColor("Color:""MyColor");
$form->addEmail("Email:""MyEmail");
$form->addHTMLExternal("External HTML:");
$form->addButton();
$form->render();
?>

<br/><br/>

<?php
$form 
= new form("formelements_1");
$form->setAttributes(array(
    
"width" => "850"
));    

if(!empty(
$_GET["errormsg_1"]))
    
$form->errorMsg filter_var(stripslashes($_GET["errormsg_1"]), FILTER_SANITIZE_SPECIAL_CHARS);

$form->addHidden("cmd""submit_1");
$form->addWebEditor("Web Editor - TinyMCE:""MyWebEditor");
$form->addCKEditor("Web Editor - CKEditor:""MyCKEditor");
$form->addButton();
$form->render();
?>