I feel bad about asking a question like this, but I've spent quite a bit of
time trying to track down what should be a simple answer and, no luck.

I'm trying to create a simple function that will match two form fields
against each other, e.g. "Email" equals "Repeat Email".  The following
function seems to work, however, I'm a little uncomfortable because I don't
understand it.  Specifically, I don't understand why returning $str1 by
itself (or $str2 by itself) makes it work.

/* checks two fields against each other to make sure they match and if they
don't match it throws an error message into the $err_text array */

function CheckMatch($str1, $str2, $name)
        global $err_text;
        $match = ($str1 == $str2);
        if ($match != true)
                $err_text[] = "$name must match.";
        return $str1;

Any help is appreciated!  Thanks!


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to