<?php
$errMsg 
"";
$showForm true;
$showConf false;

$titleVals = array("" => "Select Title","Mr" => "Mr.","Miss" => "Miss.","Mrs" => "Mrs.","Rev" => "Rev.");
$genderVals = array("M"=>"Male","F"=>"Female");
$skillVals = array("asp" => "ASP","php" => "PHP","coldfusion" => "ColdFusion","jsp" => "JSP","asp.net" => "ASP.NET");
$monthArr = array("January","February","March","April","May","June","July","August","September","October","November","December");

$dobDayVals[""] = "Select Day";
for(
$i=1;$i<=31;$i++){
    
$dobDayVals[$i] = $i;
}
$dobMonthVals[""] = "Select Month";
for(
$i=1;$i<=12;$i++){
    
$dobMonthVals[$i] = $monthArr[$i-1];
}
$dobYearVals[""] = "Select Year";
$curYear date("Y");
for(
$i=($curYear-80);$i<=($curYear-8);$i++){
    
$dobYearVals[$i] = $i;
}

$valCountry[""] = "Select Country";
include(
"sample.country.inc.php");//Get Country List

include("class.easyformproc.inc.php");

//Create Instance
$formGen = new easyFormProc();

#Set Elements
$formGen -> setTextElement("username","",50,25,"txtboxes","valAlphaNum","Enter preferred Username"); 
$formGen -> setPasswordElement("psword","",50,25,"txtboxes",false,true,"Enter Password"); 
$formGen -> setPasswordElement("repsword","",50,25,"txtboxes",false,"psword","ReEntered Password Mismatch"); 

$formGen -> setSelectElement("title",$titleVals,"","txtboxes",1,false,"valNonEmpty","Select Title"); 
$formGen -> setTextElement("fname","",50,25,"txtboxes","valNonEmpty","Enter First Name"); 
$formGen -> setTextElement("lname","",50,25,"txtboxes","valNonEmpty","Enter Last Name"); 
$formGen -> setTextElement("address1","",50,25,"txtboxes","valNonEmpty","Enter Address1"); 
$formGen -> setTextElement("address2","",50,25,"txtboxes"); 
$formGen -> setTextElement("city","",50,25,"txtboxes","valNonEmpty","Enter City"); 
$formGen -> setTextElement("state","",50,25,"txtboxes"); 
$formGen -> setTextElement("zip","",50,25,"txtboxes","valNonEmpty","Enter Zip Code"); 
$formGen -> setSelectElement("country",$valCountry,"","txtboxes",1,false,"valNonEmpty","Select Country"); 
$formGen -> setRadioElement("gender",$genderVals,"","style1","valNonEmpty","Select Gender");
$formGen -> setSelectElement("dobday",$dobDayVals,"","style1");
$formGen -> setSelectElement("dobmonth",$dobMonthVals,"","style1");
$formGen -> setSelectElement("dobyear",$dobYearVals,"","style1");
$formGen -> setTextElement("email","",100,40,"txtboxes","valEmail","Invalid Email"); 
$formGen -> setTextElement("phone","",20,20,"txtboxes","valNum","Invalid Phone No"); 
$formGen -> setCheckElement("skills",$skillVals,array(),"style1","valNonEmpty","Select Skill(s)"); 

#Process Form
$disForm $formGen -> processForm("Submit Information","buttons");

#Get HTML of the elements
$disElementHTML $formGen -> getDisElementHTML();

#Get Error Messages    
$errMsg $formGen -> getErrorMsg("The following errors occured","style2");

#Get Posted Values
$postedVals $formGen -> getPostedElementValues();

#If Form is posted
if(count($postedVals)){
    
#Preview values
    
echo "<pre>";
    
print_r($postedVals);
    echo 
"</pre>";
    
/*    
    #Process Posted Values
    */
    
$showForm=false;
    
$showConf=true;    
}
?>
<html>
<head>
<title>Registration Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="500"  border="0" cellspacing="0" cellpadding="4">
<?php
if($showForm){
    echo 
$disForm["form"]["start"];
?>
  <tr>
    <td colspan="2" class="style1"><strong>User Registeration </strong></td>
      </tr>  
  <tr>
    <td colspan="2"><?php echo $errMsg;?></td>
      </tr>
  <tr>
    <td colspan="2" class="style1"><strong>Login Information</strong></td>
  </tr>
  <tr>
    <td class="style1">Username <span class="style2">* </span></td>
    <td><?php echo $disElementHTML["username"];?></td>
  </tr>
  <tr>
    <td class="style1">Password<span class="style2"> *</span></td>
    <td><?php echo $disElementHTML["psword"];?></td>
  </tr>
  <tr>
    <td class="style1">Re-Enter Password <span class="style2">*</span></td>
    <td><?php echo $disElementHTML["repsword"];?></td>
  </tr>
  <tr>
    <td colspan="2" class="style1"><strong>Personal Information</strong></td>
  </tr>
  <tr>
    <td width="236" class="style1">Title<span class="style2"> *</span></td>
        <td width="248"><?php echo $disElementHTML["title"];?></td>
      </tr>
  <tr>
    <td class="style1">First Name <span class="style2"> *</span></td>
        <td><?php echo $disElementHTML["fname"];?></td>
      </tr>
  <tr>
    <td class="style1">Last Name <span class="style2"> *</span></td>
        <td><?php echo $disElementHTML["lname"];?></td>
      </tr>
  <tr>
    <td class="style1">Address 1 <span class="style2"> *</span></td>
        <td><?php echo $disElementHTML["address1"];?></td>
      </tr>
  <tr>
    <td class="style1">Address 2 </td>
        <td><?php echo $disElementHTML["address2"];?></td>
      </tr>
  <tr>
    <td class="style1">City<span class="style2"> *</span></td>
    <td><?php echo $disElementHTML["city"];?></td>
  </tr>
  <tr>
    <td class="style1">State</td>
    <td><?php echo $disElementHTML["state"];?></td>
  </tr>
  <tr>
    <td class="style1">Zip<span class="style2"> *</span></td>
    <td><?php echo $disElementHTML["zip"];?></td>
  </tr>
  <tr>
    <td class="style1">Country<span class="style2"> *</span></td>
    <td><?php echo $disElementHTML["country"];?></td>
  </tr>
  <tr>
    <td class="style1">Gender<span class="style2"> *</span></td>
    <td><?php echo implode("&nbsp;&nbsp;&nbsp;",$disElementHTML["gender"]);?></td>
  </tr>
  <tr>
    <td class="style1">Date Of Birth</td>
    <td><?php echo $disElementHTML["dobday"];?> <?php echo $disElementHTML["dobmonth"];?> <?php echo $disElementHTML["dobyear"];?></td>
  </tr>
  <tr>
    <td class="style1">Email<span class="style2"> *</span></td>
    <td><?php echo $disElementHTML["email"];?></td>
  </tr>
  <tr>
    <td class="style1">Phone<span class="style2"> *</span></td>
    <td><?php echo $disElementHTML["phone"];?></td>
  </tr>
  <tr>
    <td align="left" valign="top" class="style1">Skills<span class="style2"> *</span></td>
    <td align="left"><?php echo implode("",$disElementHTML["skills"]);?></td>
  </tr>
  <tr>
    <td class="style1">&nbsp;</td>
        <td align="right"><?php echo $disForm["submit"];?></td>
      </tr>
<?php
    
echo $disForm["form"]["end"];
}
if(
$showConf){
?>
     <tr>
        <td class="style1" colspan="2">Values Successfully posted.</td>
  </tr>
</table>
<?php
}
?>
</body>
</html>