PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Asokan Sivasubramanian   HTML Form Fields Generator   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Default execution file
Class: HTML Form Fields Generator
Display HTML form fields
Author: By
Last change:
Date: 15 years ago
Size: 4,092 bytes
 

Contents

Class file image Download
<?php
/****************************************************************************************************
 * Script: index.php
 * Package: HTML FORM FIELDS GENERATOR
 * Author: Asokan Sivasubramanian
 * Contact: asokan.zil016@gmail.com
 * Date: September 8th, 2009
 * Version: 1.0
 *
 *
 * Notes:
 * (1) Need include generator.class.php
 * (2) Support php4 / php5
 *
 ***************************************************************************************************/

  
include("generator.class.php");

  
//Create a instant
  
$db_obj = new Generator;
  
  
//Make username as TEXTBOX
  
$textbox_username = $db_obj->create_textbox($fld_type='text',$fld_name='username',$fld_val='',$max_len=20);

  
//Make password as TEXTBOX
  
$textbox_password = $db_obj->create_textbox($fld_type='password',$fld_name='password',$fld_val='',$max_len=12);

  
//Make password as TEXTBOX
  
$textarea_comments = $db_obj->create_textarea($fld_name='comments',$fld_val='this is sample text',$rows=6,$cols=35);

  
//Make Option BOX
  
$Top_Sites = array('1'=>"Google",
                     
'2'=>"Yahoo",
                     
'3'=>"Myspace",
                     
'4'=>"Hi5",
                     
'5'=>"Youtube",
                     
'6'=>"Gmail"
                
);
                

  
//Called option box
  
$optionbox_website = $db_obj->create_optionbox($fld_name='website',$input_array=$Top_Sites,$selected=4,$style='width=200px');



  
//Make CHECKBOX
  
$country_list = array('1'=>"INDIA",
                        
'2'=>"US",
                        
'3'=>"UK",
                        
'4'=>"CANADA",
                        
'5'=>"SRI LANKA",
                        
'6'=>"CHINA"
                       
);


  
//Called CHECK BOX
  
$checkbox_country = $db_obj->create_checkbox($fld_name='country',$input_array=$country_list,$selectedlist=3,$num_rows=2);



  
//Make RADIO BOX
  
$gender_list = array('1'=>"MALE",
                        
'2'=>"FEMALE",
                        
'3'=>"TRANSEX"
                       
);


  
//Called CHECK BOX
  
$radiobox_gender = $db_obj->create_radiobox($fld_name='gender',$input_array=$gender_list,$selectedlist=1,$num_rows=2);

?>
<html>
  <head>
    <title>HTML FORM FIELDS GENERATOR</title>
  </head>
  <body align=center>
    <table border=1px width=500 height=100%>
      <tr>
        <td valign=top>
          <table>
             <form name='form1' id='form1' method='post' action='index.php'>

               <tr>
                  <td valign=top>Enter Your Name</td>
                  <td><?php echo $textbox_username; ?></td>
               </tr>
               <tr>
                  <td colspan=2>&nbsp;&nbsp;</td>
               </tr>

               <tr>
                  <td valign=top>Enter Your Password</td>
                  <td><?php echo $textbox_password; ?></td>
               </tr>
               <tr>
                  <td colspan=2>&nbsp;&nbsp;</td>
               </tr>

               <tr>
                  <td valign=top>Enter Your Comments</td>
                  <td><?php echo $textarea_comments; ?></td>
               </tr>
               <tr>
                  <td colspan=2>&nbsp;&nbsp;</td>
               </tr>

               <tr>
                  <td valign=top>Favourite Website</td>
                  <td><?php echo $optionbox_website; ?></td>
               </tr>
               <tr>
                  <td colspan=2>&nbsp;&nbsp;</td>
               </tr>

               <tr>
                  <td valign=top>Optional Country</td>
                  <td><?php echo $checkbox_country; ?></td>
               </tr>
               <tr>
                  <td colspan=2>&nbsp;&nbsp;</td>
               </tr>

               <tr>
                  <td valign=top>Choose Gender</td>
                  <td><?php echo $radiobox_gender; ?></td>
               </tr>

             </form>
         </table>
        </td>
      <tr>
    <table>
  </body>
</html>