If you are using PHP4 try the preg_match function.
(preg_match ("/\W/",$form_field_name))
As for your email create ad the following javascript to your page as a function. In this case call it FormatEmail.
<!--- java script --->
function EmailError (obj) {
return FormError (obj, '"' + obj.value + '" is not a valid email address.');
}
function FormatEmail (obj) {
obj.value = Trim (obj.value);
if (obj.value.length == 0)
return true;
ndx = 0;
atsign = false;
dot = false;
while (ndx < obj.value.length) {
if (obj.value.charAt(ndx) == ' ')
return EmailError (obj);
if (obj.value.charAt(ndx) == '@') {
atsign = true;
++ndx;
break;
}
++ndx;
}
if (!atsign) return EmailError (obj);
while (ndx < obj.value.length) {
if (obj.value.charAt(ndx) == ' ')
return EmailError (obj);
if (obj.value.charAt(ndx) == '.') {
dot = true;
}
++ndx;
}
if (!dot) return EmailError (obj);
return true;
}
function EmailRequired (obj, msg) {
if (!EditRequired (obj, msg))
return false;
return FormatEmail (obj);
}
<!--- end of java script --->
Then add the following line to your email input form. onchange="FormatEmail (this);"
Example:
<input onchange="FormatEmail (this);" size="25" name="email">