I've created a form that passes data to php script to be validated. I'm using the ereg function for this.
My problem is that when using the ereg function I get a whitescreen as my output no matter what data is held in the variable that I'm using with ereg. Here's my script:
<?
// validate "name" field from workorder.php
if (!ereg("[a-zA-Z][[:Space:]][a-zA-Z]$", $name) echo "Improper name format";
//validate "email" field from workorder.php
if (!ereg("[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)@[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)*$", $email) echo "Improper email format";
?>
I've also tried it this way:
<?
// validate "name" field from workorder.php
if (!ereg("[a-zA-Z][[:Space:]][a-zA-Z]$", $name) {
echo "Improper name format";
}
//validate "email" field from workorder.php
if (!ereg("[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)@[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)*$", $email) {
echo "Improper email format";
}
?>
I've even tried a simple test:
<?
//ereg test
if (ereg([a-zA-Z], $name) echo "not a letter";
?>
This too, outputs a whitescreen.
Am I doing something wrong, or could it be a problem with my php.ini file? I'm using php 4.20.
Any help would be greatly appreciated.
thanks!