Login   Register  
PHP Classes
elePHPant
Icontem

File: sample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Rafat Katta  >  Dynamic form class lib  >  sample.php  >  Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: Example for use it
Class: Dynamic form class lib
Generate HTML forms
Author: By
Last change:
Date: 8 years ago
Size: 3,881 bytes
 

Contents

Class file image Download
<? 
// This is a Test off the new class strurct or library

include("lib.element.class.inc");
// Beginn of Form creation**************************
$oForm=new CBasicForm("My_Test_Form","");
$oForm->setLabel('<b>My Basic Form</b>');
//CTextElement($name,$lable,$type,&$oForm)
$oNameTextElement=& new CTextElement("Name",'Name',$oForm);
$oNameTextElement->setLabel('Name');
$oFamilyNameTextElement=& new CTextElement("FName",'Family Name',$oForm);
$oUserNameElement=& new CTextElement("UName",'User Name',$oForm);
//    CPasswdElement($name,$lable,&$oForm)
$oPasswdElement=& new CPasswdElement("Pwd",'Password',$oForm);
// CSubmitElement($name,$value,&$oForm)
$oSubmit=& new CSubmitElement("submit","submit",$oForm);
// End of Form creation ********************
$oForm->showHtml();
//  basic form !!!!!!
//other way********
include_once("simpletableformatdeform.class.inc");
$oForm=& new CSTblForm("My_Test_Form","");
//CTextElement($name,$lable,$type,&$oForm)
$oNameTextElement=& new CTextElement("Name",'Name',$oForm);
$oFamilyNameTextElement=& new CTextElement("FName","Family Name",$oForm);
$oUserNameElement=& new CTextElement("UName","User Name",$oForm);
$oPasswdElement=& new CPasswdElement("Pwd",'Password',$oForm);
// CSubmitElement($name,$value,&$oForm)
$oSubmit=& new CSubmitElement("submit","submit",$oForm);
// End of Form creation ********************
$oForm->showHtml();
//****************
include_once("tableformatdeform.class.inc");
$oForm=new CTblForm("My_Test_Form","");
//CTextElement($name,$lable,$type,&$oForm)
$oNameTextElement=& new CTextElement("Name",'Name',$oForm);
$oFamilyNameTextElement=& new CTextElement("FName","Family Name",$oForm);
$oUserNameElement=& new CTextElement("UName","User Name",$oForm);
$oPasswdElement=& new CPasswdElement("Pwd",'Password',$oForm);
// CSubmitElement($name,$value,&$oForm)
$oSubmit=& new CSubmitElement("submit","submit",$oForm);
// End of Form creation ********************
$oForm->showHtml();
// YOU CAN USE THE OOP WAY*************************
class myForm extends CBasicForm // You can use other Form classes too !!!!1
{
//** your Class variables for other Works......********
    
var $strName='Rafat';
    var 
$strFamilyName='Katta';
    var 
$strOrganization="gsibc.net";
    var 
$strStreet='Huda Al Scharawi';
    var 
$intPcode=16019;
    var 
$strCity="Aleppo";
    var 
$strContryCode='None';
    var 
$intPhone='2121778';
    var 
$intFax="2121778";
    var 
$strEMail='my@mail.com';    
// your set and get or other functions for your class property or variable*****
    
function myForm($strFormName,$strFormHeader,$strFormAcion){
    
        
parent::CBasicForm($strFormName,$strFormAcion);
        
$this->setLabel($strFormHeader);
    
$oNameTextElement[0]=& new CTextElement($this->strName,$this->strName,$this);
    
$oNameTextElement[1]=& new CTextElement($this->strFamilyName,$this->strFamilyName,$this);
    
$oNameTextElement[2]=& new CTextElement($this->strOrganization,$this->strOrganization,$this);
    
$oNameTextElement[3]=& new CTextElement($this->strStreet,$this->strStreet,$this);
    
$oNameTextElement[4]=& new CTextElement($this->intPcode,$this->intPcode,$this);
    
$oNameTextElement[5]=& new CTextElement($this->strCity,$this->strCity,$this);
    
$oNameTextElement[6]=& new CTextElement($this->strContryCode,$this->strContryCode,$this);
    
$oNameTextElement[7]=& new CTextElement($this->intPhone,$this->intPhone,$this);
    
$oNameTextElement[8]=& new CTextElement($this->intFax,$this->intFax,$this);
    
$oNameTextElement[9]=& new CTextElement($this->strEMail,$this->strEMail,$this);
    
$oSubmit=& new CSubmitElement("submit","submit",$this);    
    }
    
// you can overwrite the Methjod shoHtml() If you want that !!!!!    
}
$oNewForm= new myForm('Personal Form','<b>give me your personal Data</b>',"");
$oNewForm->showHtml();

$oNewForm1= new myForm('Worker Form','Worker Form',"");
$oNewForm1->showHtml();

?>