Jump to content

Syntax problem?


Bottyz

Recommended Posts

Hi all, just a quickie.

 

I want to only run a validate fax function if a fax number is entered... but i cant get the validate fax function to run from within the if statement.

 

It runs fine if i set it up without the if user_fax!= '' statement. but i want the fax field optional.


if ($user_fax != '') {
if (validate_fax($user_fax) ) {
$errors.="ERROR: Please enter a valid Fax Number including extension if applicable.<br><br>";
}
}

 

what am i doing wrong? thanks

Link to comment
https://forums.phpfreaks.com/topic/189634-syntax-problem/
Share on other sites

Thanks Jl5501, slightly different issue now

 

EDIT...

 

think it is now something to do with my validate function:

 

function validate_fax($fax) {
return preg_match('/^([0-9,+() ]{9,})+$/i', $fax);
}

 

Is my syntax correct for allowing only digits, brackets, plus symbol and spaces 9 characters minimum in length?

Link to comment
https://forums.phpfreaks.com/topic/189634-syntax-problem/#findComment-1000839
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.