<?php $errMsg = ""; $showForm = true; $showConf = false;
$sectionVals = array("pda" => "PDA", "mobile" => "Mobile", "security" => "Security", "internet" => "Internet", "devnwebauth" => "Development & Web Authoring", "isit" => "IS/IT", "games" => "Games", "business" => "Business", "audvideo" => "Audio and video", "destools" => "Design tools", "deskenhance" => "Desktop Enhancements", "homeedu" => "Home and education");
include("class.easyformproc.inc.php");
//Create Instance $formGen = new easyFormProc();
#Set Elements $formGen -> setSelectElement("section",$sectionVals,array(),"txtboxes",8,true,"valNonEmpty","Select atleast one section"); $formGen -> setFileElement("upfile","txtboxes",true,"Upload error",500,array("image/jpeg"=>"JPG","image/gif"=>"GIF"));
#Process Form $disForm = $formGen -> processForm("Upload File","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>Using multiple select list box and File element </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>Upload File </strong></td> </tr> <tr> <td colspan="2"><?php echo $errMsg;?></td> </tr> <tr> <td width="236" class="style1"> Section(s) <span class="style2">* </span></td> <td width="248"><?php echo $disElementHTML["section"];?></td> </tr> <tr> <td class="style1">File <span class="style2">*</span></td> <td><?php echo $disElementHTML["upfile"];?></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>
|