<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Form Validation Call for help</title>
	<atom:link href="http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/</link>
	<description></description>
	<pubDate>Wed, 08 Oct 2008 10:39:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: casey</title>
		<link>http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8139</link>
		<dc:creator>casey</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8139</guid>
		<description>I've been trying to figure this out forever too, and its really annoying, but here's a function that seems to work perfectly, I got it from the user comments at php.net
http://www.php.net/manual/en/function.ereg.php

if (ereg('^[[:alnum:]]+&#36;', &#36;data)) { 
   echo '&#36;data contains only letters and/or numbers'; 
} else { 
   echo '&#36;data contains characters other than letters and /or numbers.'; 
}

and if you want to add characters to allow, like an underscore for instance, add a pipe and the _ after the [:alnum:], like so:

if (ereg('^[[:alnum:]&#124;_]+&#36;', &#36;data)) { 
   echo '&#36;data contains only letters and/or numbers'; 
} else { 
   echo '&#36;data contains characters other than letters and /or numbers.'; 
}

hope that helps
</description>
		<content:encoded><![CDATA[<p>I&#039;ve been trying to figure this out forever too, and its really annoying, but here&#039;s a function that seems to work perfectly, I got it from the user comments at php.net<br />
<a href="http://www.php.net/manual/en/function.ereg.php" rel="nofollow">http://www.php.net/manual/en/function.ereg.php</a></p>
<p>if (ereg(&#039;^[[:alnum:]]+&#36;&#039;, &#36;data)) {<br />
   echo &#039;&#36;data contains only letters and/or numbers&#039;;<br />
} else {<br />
   echo &#039;&#36;data contains characters other than letters and /or numbers.&#039;;<br />
}</p>
<p>and if you want to add characters to allow, like an underscore for instance, add a pipe and the _ after the [:alnum:], like so:</p>
<p>if (ereg(&#039;^[[:alnum:]|_]+&#36;&#039;, &#36;data)) {<br />
   echo &#039;&#36;data contains only letters and/or numbers&#039;;<br />
} else {<br />
   echo &#039;&#36;data contains characters other than letters and /or numbers.&#039;;<br />
}</p>
<p>hope that helps</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jennifer</title>
		<link>http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8138</link>
		<dc:creator>Jennifer</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8138</guid>
		<description>=sigh=
I still don't get it...
Why would case have anything to do with it...
the only difference is that "i" vs. "s"

with "s"
3#3 is allowed

with "i"
3#3 is not

...duh... I'm so lost.
I'll send you some Reese's Pieces to give to your friend... :) (Does he like Tiaras? LOL!)</description>
		<content:encoded><![CDATA[<p>=sigh=<br />
I still don&#039;t get it&#8230;<br />
Why would case have anything to do with it&#8230;<br />
the only difference is that &#034;i&#034; vs. &#034;s&#034;</p>
<p>with &#034;s&#034;<br />
3#3 is allowed</p>
<p>with &#034;i&#034;<br />
3#3 is not</p>
<p>&#8230;duh&#8230; I&#039;m so lost.<br />
I&#039;ll send you some Reese&#039;s Pieces to give to your friend&#8230; <img src='http://www.scriptygoddess.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> (Does he like Tiaras? LOL!)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amy</title>
		<link>http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8137</link>
		<dc:creator>Amy</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8137</guid>
		<description>I'd hang on to the tiara, Jenn.  I didn't write the function - many, many months ago I handed my first effort at it to Gareth, who patted me on the head and sent me back what you see here.

I pinged him and asked for an explanation that's readable in English, and here's his response:

&lt;b&gt;"The $ matches the end of the line.  The i is a flag meaning 'case insensitive match.'  Likewise, the ^ at the beginning matches the beginning of the line.  It won't match (allow) any strings that contain spaces or whatever at the beginning/end.&lt;/b&gt;  

&lt;b&gt;"One could argue that you could use /^&#92;w+$/ instead, but then it'd match (allow) the underscore character as well."&lt;/b&gt;

Personally, I hate regexes.  They drive me insane on a regular basis.  I bribe Gareth with Reese's Pieces (which are hard to get and expensive  in Britain)  to get help for regex issues like this.  :)</description>
		<content:encoded><![CDATA[<p>I&#039;d hang on to the tiara, Jenn.  I didn&#039;t write the function - many, many months ago I handed my first effort at it to Gareth, who patted me on the head and sent me back what you see here.</p>
<p>I pinged him and asked for an explanation that&#039;s readable in English, and here&#039;s his response:</p>
<p><b>&#034;The $ matches the end of the line.  The i is a flag meaning &#039;case insensitive match.&#039;  Likewise, the ^ at the beginning matches the beginning of the line.  It won&#039;t match (allow) any strings that contain spaces or whatever at the beginning/end.</b>  </p>
<p><b>&#034;One could argue that you could use /^&#92;w+$/ instead, but then it&#039;d match (allow) the underscore character as well.&#034;</b></p>
<p>Personally, I hate regexes.  They drive me insane on a regular basis.  I bribe Gareth with Reese&#039;s Pieces (which are hard to get and expensive  in Britain)  to get help for regex issues like this.  <img src='http://www.scriptygoddess.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jennifer</title>
		<link>http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8136</link>
		<dc:creator>Jennifer</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8136</guid>
		<description>nope... my mistake. Yours works. Okay, you win the tiara! ;-)

&lt;b&gt;But&lt;/b&gt; you have to explain to me why it works...

the difference between what you were doing with the preg_match, and what I was doing... is the last part... the "+$/i"... I had been using "+$/s" (which didn't catch special charcters in the middle)

Can you tell me whats going on there? What does the "i" or "s" mean?</description>
		<content:encoded><![CDATA[<p>nope&#8230; my mistake. Yours works. Okay, you win the tiara! <img src='http://www.scriptygoddess.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /><br />
<b>But</b> you have to explain to me why it works&#8230;</p>
<p>the difference between what you were doing with the preg_match, and what I was doing&#8230; is the last part&#8230; the &#034;+$/i&#034;&#8230; I had been using &#034;+$/s&#034; (which didn&#039;t catch special charcters in the middle)</p>
<p>Can you tell me whats going on there? What does the &#034;i&#034; or &#034;s&#034; mean?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jennifer</title>
		<link>http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8135</link>
		<dc:creator>jennifer</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8135</guid>
		<description>Ok, when I tried those types of functions... it seemed to not catch it when it was a special character in the MIDDLE of alphanumeric characters.. it would only catch if it began or ended with a special character:
so:
3%2 would be acceptable
%32 would not be
32% would not be...

That's why I got into the whole check every character thing...</description>
		<content:encoded><![CDATA[<p>Ok, when I tried those types of functions&#8230; it seemed to not catch it when it was a special character in the MIDDLE of alphanumeric characters.. it would only catch if it began or ended with a special character:<br />
so:<br />
3%2 would be acceptable<br />
%32 would not be<br />
32% would not be&#8230;</p>
<p>That&#039;s why I got into the whole check every character thing&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amy</title>
		<link>http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8134</link>
		<dc:creator>Amy</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8134</guid>
		<description>Oooh!  Something I can help with!

&lt;b&gt;function is_alphanumeric($test) {
    return (preg_match("/^[a-z0-9 ]+$/i", $test));
}
&lt;/b&gt;


Run it like this:

if ( !is_alphanumeric($submitted_variable) ) {
&#160;&#160;# fire error stuff
}</description>
		<content:encoded><![CDATA[<p>Oooh!  Something I can help with!</p>
<p><b>function is_alphanumeric($test) {<br />
    return (preg_match(&#034;/^[a-z0-9 ]+$/i&#034;, $test));<br />
}<br />
</b></p>
<p>Run it like this:</p>
<p>if ( !is_alphanumeric($submitted_variable) ) {<br />
&nbsp;&nbsp;# fire error stuff<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jennifer</title>
		<link>http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8133</link>
		<dc:creator>Jennifer</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8133</guid>
		<description>htmlscpecialchars() will translate special charcaters... 

It's probalby going to be some form of this function:
ereg() but the question is what do I put in there to deny all special characters...</description>
		<content:encoded><![CDATA[<p>htmlscpecialchars() will translate special charcaters&#8230; </p>
<p>It&#039;s probalby going to be some form of this function:<br />
ereg() but the question is what do I put in there to deny all special characters&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jennifer</title>
		<link>http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8132</link>
		<dc:creator>Jennifer</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8132</guid>
		<description>Yeah, I saw that... and what he has there will validate that the string contains at least 1 alpha numeric character... but it could be mixed with special characters... I want to have it reject any and all special characters...</description>
		<content:encoded><![CDATA[<p>Yeah, I saw that&#8230; and what he has there will validate that the string contains at least 1 alpha numeric character&#8230; but it could be mixed with special characters&#8230; I want to have it reject any and all special characters&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kristine</title>
		<link>http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8131</link>
		<dc:creator>kristine</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8131</guid>
		<description>Oh, and maybe something to do with htmlspecialchars() ?
&lt;a href="http://www.php.net/manual/en/function.htmlspecialchars.php" target="_blank"&gt;php.net - htmlspecialchars&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Oh, and maybe something to do with htmlspecialchars() ?<br />
<a href="http://www.php.net/manual/en/function.htmlspecialchars.php" target="_blank">php.net - htmlspecialchars</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kristine</title>
		<link>http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8130</link>
		<dc:creator>kristine</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/09/16/form-validation-call-for-help/#comment-8130</guid>
		<description>(I'm not sure if this is helpful or not, but here's what google found me!)
&lt;a href="http://www.digi-fx.net/articles/programming/formvalidation-php.php" target="_blank"&gt;form validation&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>(I&#039;m not sure if this is helpful or not, but here&#039;s what google found me!)<br />
<a href="http://www.digi-fx.net/articles/programming/formvalidation-php.php" target="_blank">form validation</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.543 seconds -->
