Location: PHPKode > scripts > Dynamic Elements Processor with PHP 5 > dynamic-elements-processor-with-php-5/php_publ241109.htm
<html>

<head>
<meta http-equiv="Content-Language" content="de-ch">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Dynamic Elements Processor with PHP 5</title>
</head>

<body>

<table border="0" width="100%">
  <tr>
    <td width="100%"><font face="Arial" size="1">Building forms and elements for websites sometimes means a lot of work, specially if you create bigger websites. Luckily there a some great tools like QuickForm from PEAR which is very powerfull, but asks to install the PEAR environment. Well this application asks only for three class files and is quiet easy to implement (see screenshots <a href="#screenshot">below</a>). This application makes use of the RecursiveArrayIterator from PHP 5 and an Element Iterator to loop through all parts of the elements. Among other features you'll find submit, select, text, textarea, radio and other elements, which have not to be related to forms - such as the Span, Div or Table element (in total 17). If you make usage of the Dynamic Elements Processor you need only two three lines to create an element: The name of the element, the options and the append part of the script. Hint: If you use several elements one behind the other with empty options, the option element may not be removed. That's all there is to consider.<br>
					</font>
					<p><font face="Arial" size="1">The scripts snippets you see here (the complete script is <a href="#load">downloadable</a>)&nbsp;is only a small part of the complete application. That's it. All stuff is all prepared for your convenience (example and class-files included). <i>Best regards Claudio Biesele</i></font></p>
				</td>
  </tr>
  <tr>
    <td width="100%">
      <hr>
					<p><font face="Arial" size="1"><b>Part of the  Elements Creation Code :</b></font></p>
					<p><font size="1" color="blue" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">$newelement-&gt;createElementType('textarea');<br>
							$newelement-&gt;addOptions(&quot;tabindex='11',rows='4',cols='40'&quot;);<br>$newelement-&gt;appendElement('','textareaName','content'); </font><font size="1" color="blue" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><br>
							<br>
						</font></p>
					<p><font size="1" color="blue" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"> </font></p>
				</td>
  </tr>
			<tr>
    <td width="100%">
      <hr>
					<p><font face="Arial" size="1"><b>Part of the ProcessElements Class Code:</b></font></p>
					<p><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">public function createFormStart($formdata) {<br>
						</font><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">&nbsp;&nbsp;$this-&gt;formdata = $formdata;<br>
						</font><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while(list($this-&gt;key, $this-&gt;val) = each($this-&gt;formdata))</font><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">  {<br>
						</font><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;&lt;form action=\&quot;{$this-&gt;val[0]}\&quot; method=\&quot;{$this-&gt;val[1]}\&quot; name=\&quot;{$this-&gt;val[2]}\&quot; enctype=\&quot;{$this-&gt;val[3]}\&quot; {$this-&gt;val[4]}&gt;&quot;;<br>
						</font><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">&nbsp;&nbsp;}<br>
						</font><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"> }</font><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><br>
						</font><font size="1" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><a name="screenshot"></a></font></p>
				</td>
  </tr>
			<tr>
    <td width="100%">
      <hr>
    </td>
  </tr>
			<tr>
    <td width="100%"><img border="0" src="images/element_1.jpg" width="475" height="406"></td>
  </tr>
			<tr>
    <td width="100%"><font face="Arial" size="1"><b>16 Examples:</b> To create the necessary code you need only two,three lines per element.</font></td>
  </tr>
			<tr>
				<td width="100%"></td>
			</tr>
			<tr>
    <td width="100%"><font face="Arial" size="1">Download the full script at <a href="http://www.fastproject.ch/publikationen/DynElementProcessor.rar#load" target="_blank">www.fastproject.ch</a>. The downloaded script is free from Copyright restrictions, Zurich, 24th of November 2009.<a name="load"></a></font></td>
  </tr>
		</table>

</body>

</html>
Return current item: Dynamic Elements Processor with PHP 5