Hi,
I have 3 fields (field1, field2, field3), I am doing if else condition which will check field3 if not equal to the value from field1 + field2, then display an error message.
Below are the codes but it will always display error message whether the codition is true or false. Can someone please kindly help, have been trying for days.
[LEFT][SIZE=13px]Undefined variable: filename[/SIZE][/LEFT]
[LEFT][SIZE=13px]test[/SIZE][/LEFT]
$old_date_format = strtotime({field1}) ; //Y-m-d H:i:s
$new_date_format = date(‘d/m/Y H:i:s’, $old_date_format); // d/m/Y H:i:s
$result = preg_replace(’/[^a-zA-Z0-9-_.]/’,’’, $new_date_format);
$field2 = {field2};
$filename = $field2 . $result;
if ({field3} != “$filename”)
{
sc_error_message(‘test’);
}
I tried hardcode the condition value then it works.
[LEFT][SIZE=13px]if ({field3} != “1234”)[/SIZE][/LEFT]
[LEFT][SIZE=13px]{[/SIZE][/LEFT]
[LEFT][SIZE=13px] sc_error_message(‘test’);[/SIZE][/LEFT]
[LEFT][SIZE=13px]}[/SIZE][/LEFT]