Forum Moderators: coopster

Message Too Old, No Replies

Simple but frustrating

         

sleepy_kiwi

9:18 pm on Jan 27, 2004 (gmt 0)

10+ Year Member



Background: Client using a third party payment gateway for ecom site. They return a string of variables - one being Result, which can be OK, Fail or Error.

Problem: Whilst I can echo and print $Result I cannot use it in a if statement.

Thought I had a reasonable knowledge of PHP but...

dubmeier

9:24 pm on Jan 27, 2004 (gmt 0)

10+ Year Member



not sure I understand the problem. Can't you just do the following?

if ($Result == "OK") {
do one thing
} elseif ($Result == "Fail") {
do another
} elseif ($Result == "Error") {
log the error
}

sleepy_kiwi

9:26 pm on Jan 27, 2004 (gmt 0)

10+ Year Member



Thats what I've tried - however it just doesn't seem to work.

BitBanger

9:39 pm on Jan 27, 2004 (gmt 0)

10+ Year Member



Put:

$Result = trim($Result);

just prior to the comparison. Chances are there are either trailing spaces or control characters in the string.