<?php $errMsg = ""; $showForm = true; $showConf = false;
$titleVals = array("" => "Select Title","Mr" => "Mr.","Miss" => "Miss.","Mrs" => "Mrs.","Rev" => "Rev.");
include("class.easyformproc.inc.php");
//Create Instance $formGen = new easyFormProc();
#Set Elements $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("email","",100,40,"txtboxes","valEmail","Invalid Email"); $formGen -> setTextElement("phone","",20,20,"txtboxes","valNum","Invalid Phone No"); $formGen -> setTextAreaElement("comments","",40,6,"txtboxes","valNonEmpty","Enter Comments");
#Process Form $disForm = $formGen -> processForm("Send","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>Basic 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="400" border="0" cellspacing="0" cellpadding="4"> <?php if($showForm){ echo $disForm["form"]["start"]; ?> <tr> <td colspan="2" class="style1"><strong>Contact Us </strong></td> </tr> <tr> <td colspan="2"><?php echo $errMsg;?></td> </tr> <tr> <td width="236" class="style1">Title</td> <td width="248"><?php echo $disElementHTML["title"];?></td> </tr> <tr> <td class="style1">First Name </td> <td><?php echo $disElementHTML["fname"];?></td> </tr> <tr> <td class="style1">Last Name </td> <td><?php echo $disElementHTML["lname"];?></td> </tr> <tr> <td class="style1">Email Address </td> <td><?php echo $disElementHTML["email"];?></td> </tr> <tr> <td class="style1">Phone No </td> <td><?php echo $disElementHTML["phone"];?></td> </tr> <tr> <td valign="top" class="style1">Comments</td> <td><?php echo $disElementHTML["comments"];?></td> </tr> <tr> <td class="style1"> </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>
|