<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
<title>Untitled Document</title>
 
<style>
 
#myForm{
 
    width:500px;
 
    border:solid 1px #fafafa;
 
}
 
#myForm label{
 
    float:left;
 
    width:200px;
 
    margin:2px;
 
}
 
#myForm input[type="text"]{
 
    width:200px;
 
    padding:3px;
 
    border-radius:4px;
 
    border:solid 1px #999999;
 
}
 
#myForm input.common_submit{
 
    width:100px;
 
    padding:3px;
 
    border-radius:4px;
 
    border:solid 1px #999999;
 
}
 
#myForm textarea{
 
    width:200px;
 
    padding:3px;
 
    height:100px;
 
    border-radius:4px;
 
    border:solid 1px #999999;
 
}
 
#myForm select{
 
    width:207px;
 
    padding:3px;
 
    border-radius:4px;
 
    border:solid 1px #999999;
 
}
 
</style>
 
</head>
 
 
<body>
 
 
<?php
 
require_once('Libs/formbuilder.class.php');
 
$countries = array('india', 'pakistan', 'america', 'rashya', 'china', 'srilanka');
 
$frm = new FormBuild();
 
$frmStr = $frm->startForm('#', 'post', 'myForm',  
 
    // optional attributes for the form 
 
    array(' class'=>'myFormClass', ' enctype'=>'multipart/form-data', ' onsubmit'=>'return checkBeforeSubmit(this)') ) .
 
    
 
    //label for the input
 
    "<p>".$frm->addLabel("Firstname", "First Name: ","").
 
    
 
    //add textbox for first name
 
    $frm->addInput('text', 'firstname', '', 
 
    //options for input
 
    array('class'=>'firstname'))."</p>".
 
    
 
    //label for the input
 
    "<p>".$frm->addLabel("Last name", "Last name: ","").
 
    
 
    //add textbox for last name
 
    $frm->addInput('text', 'lastname', '', 
 
    //options for input
 
    array('class'=>'lastname'))."</p>".
 
    
 
    //label for the input
 
    "<p>".$frm->addLabel("gender", "Gender: ","").
 
    
 
    //add textbox for last name and example for adding attribute checked
 
    $frm->addInput('radio', 'gender', 'Male', array('checked'=>"checked"))." Male".$frm->addInput('radio', 'gender', 'Female', '')." Female</p>".
 
    
 
    '<p>' . $frm->addLabel('address', 'Address', '') .  
 
    // textarea is added using addTextarea 
 
    $frm->addTextarea('address', 'your address here', array('id'=>'address', 'class'=>'address') ) . '</p>' . 
 
    
 
    //adding select box with countries
 
    '<p>'.$frm->addLabel('country', 'Country: ', '').
 
    $frm->addSelect('country', $countries, true, 'india', null, array('id'=>'country') ) . '</p>' .
 
    
 
    '<p>' . $frm->addLabel('photo', 'Your photo: ', '') . 
 
    // checkbox added using addInput 
 
    $frm->addInput('file', 'photo', array('id'=>'photo') ) . '</p>' . 
 
 
    
 
    '<p>' . $frm->addLabel('agree', 'I agree terms and conditions: ', '') . 
 
    // checkbox added using addInput 
 
    $frm->addInput('checkbox', 'agree', 1, array('id'=>'agree') ) . '</p>' . 
 
    
 
    //submit button
 
    "<p>".$frm->addLabel("submit", "","").
 
    '<p>' . $frm->addInput('submit', 'submit', 'Save', array('class'=>'common_submit')).
 
    $frm->endForm();
 
    
 
echo $frmStr;
 
?>
 
</body>
 
</html>
 
 
 |