PHP Classes

File: index.php

Recommend this page to a friend!
  Packages of Hamid Ghorashi   PHP HTML Form Elements   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Sample usage
Class: PHP HTML Form Elements
Generate HTML for form elements
Author: By
Last change:
Date: 13 years ago
Size: 2,956 bytes
 

Contents

Class file image Download
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        include './HtmlFormElements.class.php';

        $element = new HtmlFormElements();

        $element->AddProperty('placeholder', 'Username');
        $element->TextField('username', '');
        
        
        //====================================================//
        // Bind a combo box to a particular table of database //
        //====================================================//
        echo '<br/>';
        $element->AddProperty('placeholder', 'Password');
        $element->PasswordField('password', '');
        
        
        //====================================================//
        // Bind a combo box to a particular table of database //
        //====================================================//
        echo '<br/>';
        $element->AddItem('City 1', '1');
        $element->AddItem('City 2', '2');
        $element->AddItem('City 3', '3');
        $element->AddProperty('selected', '2');
        $element->ComboBox('Cities');
        
        
        //====================================================//
        // Bind a combo box to a particular table of database //
        //====================================================//
        echo '<br/>';
        $element->CheckBox('chk1', '1', 'Sample check box');
        
        
        //====================================================//
        // Bind a combo box to a particular table of database //
        //====================================================//
        echo '<br/>';
        $element->AddProperty('checked', 'checked');
        $element->RadioButton('rd1', '1', 'Sample radio button');
        
        
        //====================================================//
        // Bind a combo box to a particular table of database //
        //====================================================//
        echo '<br/>';
        $element->AddItem('male', 1);
        $element->AddItem('female', 2);
        $element->RadioGroup('gender', FALSE, 2);
        
        
        //====================================================//
        // Bind a combo box to a particular table of database //
        //====================================================//
        echo '<br/>';
        $element->AddProperty('checked', 'checked');
        $element->Button('submit', 'Submit button');
        
        
        //====================================================//
        // Bind a combo box to a particular table of database //
        //====================================================//
        echo '<br/>';
        $element->Bind('city', 'cityname', 'id', 'cityname', TRUE, FALSE);
        $element->AddProperty('selected', '6');
        $element->ComboBox('dbcombo');
        
        
        ?>
    </body>
</html>