Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
PHP find characters in field
Name: ian_ok Date: August 30, 2005 at 08:44:01 Pacific OS: win xp 98 & 2k CPU/Ram: p3 512
Comment:
I'm trying to find certain characters in a field and display and error or emove that sign now I want to allow: the @ sign but don't want to allow % , ;
If I use this: elseif (preg_match('/[[:punct:]]/', $_POST['from'])){ echo "Punct error"; } It replies error for any @ entered but I want the @ symbol to be allowed.
Also if a field contains say the word bcc I want a error to say the word bcc is not allowed or just to remove it.
Name: ian_ok Date: August 31, 2005 at 02:47:34 Pacific
Reply:
I've managed to do the code which is:
function validate_from_field($s) { $forbidden = array('%', ',', ';', 'bcc'); foreach ($forbidden as $f) if (strpos($s, $f) !== false) return false; return true; }
--- if (!validate_from_field($_POST['from'])) { echo "<h4>Sorry you have entered an invalid email address, please check and try again</h4>"; echo "Click here to return"; echo "<h4></h4>"; echo "<h4>If you are having problems with this form please email email@domain.com </h4>";
Summary: Extended characters are a bit of a problem in batch. There are two main ways to achieve what you want to do, either change the code page or find the character that is used for your characters alias. C...
Summary: In the small program described below, is there some kind of special 'null' character in C (NOT '\0' of course!) which I could pass as the 4th argument, in the 2nd call to 'printFunction()', to get the...