<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Comments on snippet: 'Form generator'</title>
    <description>Snipplr comments feed</description>
    <link>https://snipplr.com/</link>
    <lastBuildDate>Tue, 09 Jun 2026 22:44:23 +0000</lastBuildDate>
    <item>
      <title>Keef said on 13/Apr/2009</title>
      <link>https://snipplr.com/view/13820/form-generator</link>
      <description>&lt;p&gt;An example of use:&lt;/p&gt;</description>
      <pubDate>Mon, 13 Apr 2009 11:31:46 UTC</pubDate>
      <guid>https://snipplr.com/view/13820/form-generator</guid>
    </item>
    <item>
      <title>Keef said on 13/Apr/2009</title>
      <link>https://snipplr.com/view/13820/form-generator</link>
      <description>&lt;p&gt;// Your function that gets the data after the form is posted&#13;
function emailForm($data, $email) {&#13;
	foreach($data as $key =&gt; $item)&#13;
	{&#13;
		$item = str_replace(htmlentities($item), "\n", '');&#13;
		$message .= wordwrap('&lt;b&gt;'. $key. '&lt;/b&gt;'. ":". $item. "", 70);&#13;
	}&#13;
	&#13;
	$headers  = 'MIME-Version: 1.0' . "\r\n";&#13;
	$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";&#13;
	&#13;
	mail($email, 'test', $message, $headers);&#13;
}&#13;
&#13;
&#13;
$form = array(&#13;
			'escape' =&gt; true,&#13;
			'fields' =&gt; array(&#13;
				'First name' =&gt; array('rule' =&gt; '/^[a-zA-Z]+$/'),&#13;
				'Last name' =&gt; array('rule' =&gt; '/^[a-zA-Z]+$/'),&#13;
				'School/Company',&#13;
				'Town',&#13;
				'Country',&#13;
				'Phone Number',&#13;
				'Email Address' =&gt; array('rule' =&gt; VALID_EMAIL),&#13;
				'Subject' =&gt; array('type' =&gt; 'select', 'items' =&gt; array('General', 'Equipment', 'Sales', 'Technical', 'Web')),&#13;
				'Enquiry' =&gt; array('type' =&gt; 'textarea', 'cols' =&gt; 50, 'rows' =&gt; 10, 'rule' =&gt; VALID_NOT_EMPTY),&#13;
				)&#13;
			);&#13;
&#13;
displayForm($form, 'emailForm', array('keef05@gmail.com'));&lt;/p&gt;</description>
      <pubDate>Mon, 13 Apr 2009 11:32:50 UTC</pubDate>
      <guid>https://snipplr.com/view/13820/form-generator</guid>
    </item>
    <item>
      <title>Keef said on 13/Apr/2009</title>
      <link>https://snipplr.com/view/13820/form-generator</link>
      <description>&lt;p&gt;An example of use:&#13;
&#13;
	// Your function that gets the data after the form is posted&#13;
	function emailForm($data, $email) {&#13;
		foreach($data as $key =&gt; $item)&#13;
		{&#13;
			$item = str_replace(htmlentities($item), "\n", '');&#13;
			$message .= wordwrap('&lt;b&gt;'. $key. '&lt;/b&gt;'. ":". $item. "", 70);&#13;
		}&#13;
		&#13;
		$headers  = 'MIME-Version: 1.0' . "\r\n";&#13;
		$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";&#13;
		&#13;
		mail($email, 'test', $message, $headers);&#13;
	}&#13;
	&#13;
	&#13;
	$form = array(&#13;
				'escape' =&gt; true,&#13;
				'fields' =&gt; array(&#13;
					'First name' =&gt; array('rule' =&gt; '/^[a-zA-Z]+$/'),&#13;
					'Last name' =&gt; array('rule' =&gt; '/^[a-zA-Z]+$/'),&#13;
					'School/Company',&#13;
					'Town',&#13;
					'Country',&#13;
					'Phone Number',&#13;
					'Email Address' =&gt; array('rule' =&gt; VALID_EMAIL),&#13;
					'Subject' =&gt; array('type' =&gt; 'select', 'items' =&gt; array('General', 'Equipment', 'Sales', 'Technical', 'Web')),&#13;
					'Enquiry' =&gt; array('type' =&gt; 'textarea', 'cols' =&gt; 50, 'rows' =&gt; 10, 'rule' =&gt; VALID_NOT_EMPTY),&#13;
					)&#13;
				);&#13;
	&#13;
	displayForm($form, 'emailForm', array('keef05@gmail.com'));&lt;/p&gt;</description>
      <pubDate>Mon, 13 Apr 2009 11:34:17 UTC</pubDate>
      <guid>https://snipplr.com/view/13820/form-generator</guid>
    </item>
  </channel>
</rss>
