I am still learning php and I have
done a validation code below.
The problem is – I heard that the ereg is heavy on processor power
so I was thinking how can I do the same thing without the ereg ?
All the fields that i want to test end with TX eg $testTX
I just want to allow letters numbers and spaces and the – sign.
anyone any ideas ???
thanks
[code=php]
if ( ereg(“(TX)”,$field) ){
if ( !ereg( “^[A-Za-z0-9′ -]{1,30}$”,$_POST[$field]) ){
$mess = “yes”;
$message = “Please enter only characters or numbers in the description fields, address fields, reference field and the caption fields.”;
$message1 = “Problem is in $field.”;
require_once (“ag_ctr_add_fm.php”);
exit();
} // endif
} // end if