<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Made of Everything You&#039;re Not &#187; validation</title>
	<atom:link href="http://blog.ericlamb.net/tag/validation/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ericlamb.net</link>
	<description>Thoughts on programming, people and life</description>
	<lastBuildDate>Thu, 27 Oct 2011 01:29:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>HTML_QuickForm Validation Functions</title>
		<link>http://blog.ericlamb.net/2009/04/html_quickform-validation-functions/</link>
		<comments>http://blog.ericlamb.net/2009/04/html_quickform-validation-functions/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 18:04:14 +0000</pubDate>
		<dc:creator>Eric Lamb</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[HTML_QuickForm]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://blog.ericlamb.net/?p=830</guid>
		<description><![CDATA[I&#8217;ve been using HTML_QuickForm for, what feels like, forever. I&#8217;m happy to say that I haven&#8217;t, manually, written a form in years. God, do they suck to write&#8230;. I may actually be in love with HTML_QuickForm. Sigh&#8230; Not everyone like HTML_QuickForm but it meets my needs pretty well. I don&#8217;t work with any php framework, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using HTML_QuickForm for, what feels like, forever. I&#8217;m happy to say that I haven&#8217;t, manually, written a form in <em>years</em>. <em>God</em>, do they suck to write&#8230;.</p>
<p>I may actually be in love with HTML_QuickForm. </p>
<div id="attachment_1331" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.ericlamb.net/wp-content/uploads/2009/04/quickform.jpg" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2009%2F04%2Fquickform.jpg','HTML+QuickForm')"><img src="http://blog.ericlamb.net/wp-content/uploads/2009/04/quickform-300x199.jpg" alt="HTML QuickForm" title="HTML QuickForm" width="300" height="199" class="size-medium wp-image-1331" /></a><p class="wp-caption-text">HTML QuickForm</p></div>
<p>Sigh&#8230;</p>
<p>Not everyone like HTML_QuickForm but it meets my needs pretty well. I don&#8217;t work with any php framework, I use Smarty extensively (QuickForm fits like a glove with Smarty) and have yet to get hung up on the crossover between business and design logic with it. </p>
<p>It is lacking some core validation functionality though so in the spirit of open source here are just a few of the validation functions I&#8217;ve written; free and clear. </p>
<p>NOTE: I&#8217;m assuming you already know about HTML_QuickForm already. If you aren&#8217;t already familiar, the below functions just won&#8217;t mean that much to you.</p>
<p>In the below are QuickForm ready validation functions that do the following:<br />
1. Validate US PhoneNumber<br />
2. Look up a URL<br />
3. Check IP<br />
4. Ensure a date isn&#8217;t set to the past<br />
5. Ensure MySQL date format<br />
6. Ensure positive number<br />
7. Check decimal on number<br />
8. Ensure a URL is valid<br />
9. Make sure a file was uploaded (good for multi &#8220;file&#8221; field forms)</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009933; font-style: italic;">/**
 * Validation Functions
 *
 * Contains all the system validation.
 *
 * @author Eric Lamb &lt;eric@ericlamb.net&gt;
 * @version 1.0
 * @copyright	@author
 * @filesource
 * @link http://blog.ericlamb.net
 * @copyright 2005-2009 Eric Lamb
 */</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Ensures phone numbers are in the proper format
 *
 * @param   string  $element_name	name of form field to check
 * @param   string  $element_value	value of form field to check
 * @return  bool
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> CheckUSPhoneNum<span style="color: #000;">&#40;</span><span style="color: #000088;">$element_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$element_value</span><span style="color: #000;">&#41;</span>
<span style="color: #000;">&#123;</span> 
	<span style="color: #000088;">$PhoneNumber</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ereg_replace</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">&quot;[^0-9]&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$element_value</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Strip out non-numerics</span>
	<span style="color: #22f;">if</span><span style="color: #000;">&#40;</span><span style="color: #990000;">ereg</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">&quot;^([2-9][0-9]{2})([2-9][0-9]{2})([0-9]{4})$&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$PhoneNumber</span><span style="color: #339933;">,</span> <span style="color: #000088;">$NumberParts</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
		<span style="color: #22f;">return</span> <span style="color: #0000ff;">&quot;(&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$NumberParts</span><span style="color: #000;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;) &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$NumberParts</span><span style="color: #000;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;-&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$NumberParts</span><span style="color: #000;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #000;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000;">&#125;</span> <span style="color: #22f;">else</span> <span style="color: #000;">&#123;</span>
		<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #000;">&#125;</span>
<span style="color: #000;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Looks up a domain and makes sure it's valid; only works on *nix
 *
 * @param   string  $type	Type of banning to check
 * @param   string  $data	The cooresponding data to check
 * @return  bool
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> FormDomainLookup<span style="color: #000;">&#40;</span><span style="color: #000088;">$element</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #339933;">,</span> <span style="color: #000088;">$arg</span><span style="color: #000;">&#41;</span> <span style="color: #000;">&#123;</span> 
    <span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">'http://'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #000088;">$value</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">exec</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">&quot;host -t ns <span style="color: #006699; font-weight: bold;">$value</span>&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$hasil</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #22f;">if</span> <span style="color: #000;">&#40;</span><span style="color: #990000;">ereg</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">&quot;host <span style="color: #006699; font-weight: bold;">$value</span> not found.&quot;</span><span style="color: #339933;">,</span><span style="color: #990000;">strtolower</span><span style="color: #000;">&#40;</span><span style="color: #990000;">trim</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$hasil</span><span style="color: #000;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #000;">&#93;</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#41;</span> <span style="color: #000;">&#123;</span> 
        <span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span> 
    <span style="color: #000;">&#125;</span> <span style="color: #22f;">else</span> <span style="color: #000;">&#123;</span> 
        <span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span> 
    <span style="color: #000;">&#125;</span>
<span style="color: #000;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Makes sure an IP address is valid
 *
 * @param   string  $element_name	name of form field to check
 * @param   string  $element_value	IP Address to check
 * @return  bool
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> CheckIP <span style="color: #000;">&#40;</span><span style="color: #000088;">$element_name</span><span style="color: #339933;">,</span><span style="color: #000088;">$element_value</span><span style="color: #000;">&#41;</span> <span style="color: #000;">&#123;</span>
&nbsp;
	<span style="color: #000088;">$ip</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$element_value</span><span style="color: #339933;">;</span>
	<span style="color: #22f;">if</span> <span style="color: #000;">&#40;</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$longip</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ip2long</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$ip</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #000;">&#41;</span>
	<span style="color: #000;">&#123;</span>
		<span style="color: #22f;">if</span> <span style="color: #000;">&#40;</span><span style="color: #000088;">$ip</span> <span style="color: #339933;">==</span> <span style="color: #990000;">long2ip</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$longip</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#41;</span>
		<span style="color: #000;">&#123;</span>
			<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #000;">&#125;</span> <span style="color: #22f;">else</span> <span style="color: #000;">&#123;</span>
			<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #000;">&#125;</span>
	<span style="color: #000;">&#125;</span> <span style="color: #22f;">else</span> <span style="color: #000;">&#123;</span>
		<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #000;">&#125;</span> 
<span style="color: #000;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Makes sure a &quot;date&quot; isn't set to a past date.
 *
 * @param   string  $element_name	name of form field to check
 * @param   string  $element_value	Date to Check
 * @return  bool
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> StopPastDate<span style="color: #000;">&#40;</span><span style="color: #000088;">$element_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$element_value</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$vars</span><span style="color: #339933;">,</span> <span style="color: #000088;">$now</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//check that it's a valid date first</span>
	<span style="color: #000088;">$temp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$element_value</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #22f;">if</span><span style="color: #000;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">checkdate</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$temp</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'1'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$temp</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'2'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$temp</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'0'</span><span style="color: #000;">&#93;</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
		<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #000;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//now make sure the date isn't in the past.</span>
	<span style="color: #22f;">if</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$element_value</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$now</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
		<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #000;">&#125;</span> <span style="color: #22f;">else</span> <span style="color: #000;">&#123;</span>
		<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #000;">&#125;</span>
&nbsp;
<span style="color: #000;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Makes sure a &quot;date&quot; is a valid MYSQL format.
 *
 * @param   string  $element_name	name of form field to check
 * @param   string  $element_value	Date to Check
 * @return  bool
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> ValidateMysqlDate<span style="color: #000;">&#40;</span><span style="color: #000088;">$element_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$element_value</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$vars</span><span style="color: #339933;">,</span> <span style="color: #000088;">$now</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//check that it's a valid date first</span>
	<span style="color: #000088;">$temp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$element_value</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #22f;">if</span><span style="color: #000;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">checkdate</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$temp</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'1'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$temp</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'2'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$temp</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'0'</span><span style="color: #000;">&#93;</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
		<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #000;">&#125;</span>
	<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #000;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Makes sure an integer is positive
 *
 * @param   string  $element_name	name of form field to check
 * @param   string  $element_value	Int to Check
 * @return  bool
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> IsIntPositive<span style="color: #000;">&#40;</span><span style="color: #000088;">$element_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$element_value</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
&nbsp;
	<span style="color: #22f;">if</span><span style="color: #000;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_numeric</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$element_value</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
		<span style="color: #000088;">$element_value</span> <span style="color: #339933;">=</span> <span style="color: #000;">&#40;</span>int<span style="color: #000;">&#41;</span><span style="color: #000088;">$element_value</span><span style="color: #339933;">;</span>
	<span style="color: #000;">&#125;</span>
	<span style="color: #22f;">if</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$element_value</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">1</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
		<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
	<span style="color: #000;">&#125;</span>
	<span style="color: #666666; font-style: italic;">//exit;</span>
&nbsp;
	<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span>
<span style="color: #000;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Makes sure an integer isn't a decimal
 *
 * @param   string  $element_name	name of form field to check
 * @param   string  $element_value	Int to Check
 * @return  bool
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> IsIntDecimal<span style="color: #000;">&#40;</span><span style="color: #000088;">$element_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$element_value</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
&nbsp;
	<span style="color: #22f;">if</span><span style="color: #000;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_numeric</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$element_value</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
		<span style="color: #000088;">$element_value</span> <span style="color: #339933;">=</span> <span style="color: #000;">&#40;</span>int<span style="color: #000;">&#41;</span><span style="color: #000088;">$element_value</span><span style="color: #339933;">;</span>
	<span style="color: #000;">&#125;</span>
&nbsp;
	<span style="color: #22f;">if</span><span style="color: #000;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$element_value</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'.'</span><span style="color: #000;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
		<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span>
	<span style="color: #000;">&#125;</span>
	<span style="color: #666666; font-style: italic;">//exit;</span>
&nbsp;
	<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
<span style="color: #000;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Makes sure a URL is valid
 *
 * @param   string  $element_name	name of form field to check
 * @param   string  $element_value	URL to Check
 * @return  bool
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> IsURLValid<span style="color: #000;">&#40;</span><span style="color: #000088;">$element_name</span><span style="color: #339933;">,</span><span style="color: #000088;">$element_value</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
	<span style="color: #22f;">if</span> <span style="color: #000;">&#40;</span><span style="color: #990000;">preg_match</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">&quot;/^(http(s?):\/\/|ftp:\/\/{1})((\w+\.){1,})\w{2,}$/i&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$element_value</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#41;</span> <span style="color: #000;">&#123;</span>
		<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span>
	<span style="color: #000;">&#125;</span> <span style="color: #22f;">else</span> <span style="color: #000;">&#123;</span>
		<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
	<span style="color: #000;">&#125;</span>
<span style="color: #000;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Makes sure at least one file was uploaded
 *
 * @param   string  $element_name	name of form field to check
 * @param   string  $element_value	
 * @return  bool
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> EnsureUploadedFile<span style="color: #000;">&#40;</span><span style="color: #000088;">$element_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$element_value</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
	<span style="color: #22f;">foreach</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$_FILES</span> <span style="color: #22f;">AS</span> <span style="color: #000088;">$name</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$data</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
		<span style="color: #22f;">if</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'error'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'0'</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
			<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span>
		<span style="color: #000;">&#125;</span>
	<span style="color: #000;">&#125;</span>
	<span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
<span style="color: #000;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<div><a class="addthis_button" href="http://blog.ericlamb.net//addthis.com/bookmark.php?v=250" addthis:url='http://blog.ericlamb.net/2009/04/html_quickform-validation-functions/' addthis:title='HTML_QuickForm Validation Functions '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></content:encoded>
			<wfw:commentRss>http://blog.ericlamb.net/2009/04/html_quickform-validation-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

