PHP Classes

PHP Create Form: Compose and output form HTML programmatically

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 70%Total: 328 All time: 7,159 This week: 206Up
Version License PHP version Categories
phpcreateform 1.0The PHP License5PHP 5
Description 

Author

This package can compose and output form HTML programmatically.

The main class can output HTML for the different parts of the forms.

Currently it can generate HTML for the main form tag, inputs, fields and labels.

Picture of Felipe Rodrigues Dos Santos
  Performance   Level  
Name: Felipe Rodrigues Dos ... <contact>
Classes: 1 package by
Country: Brazil Brazil
Age: 35
All time rank: 3751300 in Brazil Brazil
Week rank: 321 Up24 in Brazil Brazil Up

Example

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Teste de execução da classe PHPCreateForm</title>
    </head>
    <body>
        <?php
           
require_once "class/PHPCreateForm.php";
            require_once
"class/PHPDesignForm.php";

           
$phpcreateform = new PHPCreateForm();
           
$phpdesignform = new PHPDesignForm();

           
//Setting form data
           
$phpcreateform->setNameForm("testeForm");
           
$phpcreateform->setActionForm("www.facebook.com");
           
$phpcreateform->setMethodForm("POST");

           
//Creating Form
           
$phpcreateform->createForm();
            echo
"\n ". " ". " ";

           
//Setting Label Span data
           
$phpcreateform->setLabel("Nome");
           
$phpcreateform->setTypeField("span");
           
$phpcreateform->setIdField("span01");
           
$phpcreateform->createLabel();
           
$phpcreateform->closeField();
            echo
"\n ". " ". " ";

           
//Setting Input data
           
$phpcreateform->setTypeField("input");
           
$phpcreateform->setIdField("name");
           
$phpcreateform->setType("text");
           
$phpcreateform->setClassField("name");
           
$phpcreateform->createField();
            echo
"\n ". " ". " ";

           
//Setting Space
           
$phpcreateform->createSpace();
            echo
"\n ". " ". " ";

           
//Setting Label Span data
           
$phpcreateform->setLabel("Address");
           
$phpcreateform->setTypeField("span");
           
$phpcreateform->setIdField("span02");
           
$phpcreateform->createLabel();
           
$phpcreateform->closeField();
            echo
"\n ". " ". " ";

           
//Setting Input data
           
$phpcreateform->setTypeField("input");
           
$phpcreateform->setIdField("address");
           
$phpcreateform->setType("text");
           
$phpcreateform->setClassField("address");
           
$phpcreateform->createField();
            echo
"\n ". " ". " ";

           
//Setting Space
           
$phpcreateform->createSpace();
            echo
"\n ". " ". " ";

           
//Setting Label Span data
           
$phpcreateform->setLabel("Neighborhood");
           
$phpcreateform->setTypeField("span");
           
$phpcreateform->setIdField("span03");
           
$phpcreateform->createLabel();
           
$phpcreateform->closeField();
            echo
"\n ". " ". " ";

           
//Setting Input data
           
$phpcreateform->setTypeField("input");
           
$phpcreateform->setIdField("neighborhood");
           
$phpcreateform->setType("text");
           
$phpcreateform->setClassField("neighborhood");
           
$phpcreateform->createField();
            echo
"\n ". " ". " ";

           
//Setting Space
           
$phpcreateform->createSpace();
            echo
"\n ". " ". " ";

           
//Setting Label Span data
           
$phpcreateform->setLabel("House Number");
           
$phpcreateform->setTypeField("span");
           
$phpcreateform->setIdField("span04");
           
$phpcreateform->createLabel();
           
$phpcreateform->closeField();
            echo
"\n ". " ". " ";

           
//Setting Input data
           
$phpcreateform->setTypeField("input");
           
$phpcreateform->setIdField("housenumber");
           
$phpcreateform->setType("text");
           
$phpcreateform->setClassField("housenumber");
           
$phpcreateform->createField();
            echo
"\n ". " ". " ";

           
//Setting Space
           
$phpcreateform->createSpace();
            echo
"\n ". " ". " ";

           
//Setting Label Span data
           
$phpcreateform->setLabel("Cellphone");
           
$phpcreateform->setTypeField("span");
           
$phpcreateform->setIdField("span05");
           
$phpcreateform->createLabel();
           
$phpcreateform->closeField();
            echo
"\n ". " ". " ";

           
//Setting Input data
           
$phpcreateform->setTypeField("input");
           
$phpcreateform->setIdField("cellphone");
           
$phpcreateform->setType("tel");
           
$phpcreateform->setClassField("cellphone");
           
$phpcreateform->createField();
            echo
"\n ". " ";

           
$phpcreateform->setTypeField("form");
           
$phpcreateform->closeField();
            echo
"\n ". " ";

           
//Setting input style
           
$phpdesignform->setClassStyle("name");
           
$phpdesignform->setIdStyle("name");
           
$phpdesignform->setLeftPx("120px");
           
$phpdesignform->openingStyle();
           
$phpdesignform->idStyle();

           
//Setting input style
           
$phpdesignform->setClassStyle("address");
           
$phpdesignform->setIdStyle("address");
           
$phpdesignform->idStyle();

           
//Setting input style
           
$phpdesignform->setClassStyle("neighborhood");
           
$phpdesignform->setIdStyle("neighborhood");
           
$phpdesignform->idStyle();

           
//Setting input style
           
$phpdesignform->setClassStyle("housenumber");
           
$phpdesignform->setIdStyle("housenumber");
           
$phpdesignform->idStyle();

           
//Setting input style
           
$phpdesignform->setClassStyle("cellphone");
           
$phpdesignform->setIdStyle("cellphone");
           
$phpdesignform->idStyle();
           
$phpdesignform->closingStyle();
           
       
?>
</body>
</html>


  Files folder image Files  
File Role Description
Plain text file PHPCreateForm.php Class Class that create a form
Plain text file PHPDesignForm.php Class Class that design a form
Accessible without login Plain text file teste.php Example File that test the PHPCreateForm.php and PHPDesignForm.php

 Version Control Unique User Downloads Download Rankings  
 0%
Total:328
This week:0
All time:7,159
This week:206Up
 User Ratings  
 
 All time
Utility:100%StarStarStarStarStarStar
Consistency:100%StarStarStarStarStarStar
Documentation:-
Examples:100%StarStarStarStarStarStar
Tests:-
Videos:-
Overall:70%StarStarStarStar
Rank:300