开发者

comparing Session-Value PHProblem

开发者 https://www.devze.com 2022-12-30 15:02 出处:网络
if ($_SESSION[\'user_email\']!=$开发者_如何学编程_SESSION[\'ship_user_email\']) { $to= $_SESSION[\'ship_user_email\'];
if ($_SESSION['user_email']!=$开发者_如何学编程_SESSION['ship_user_email'])
    {
        $to= $_SESSION['ship_user_email'];
        mail($to,$subject,$mail_html,$headers);
    }

there is problem in comparing values of both session. value is different but code not working.


print the values of both the session variables and check if there are leading or trailing spaces in the them.
Also check the condition with the '!==' as said by Kerry.
like this


if ( $_SESSION['user_email'] !== $_SESSION['ship_user_email'] )
    {
        $to= $_SESSION['ship_user_email'];
        mail($to,$subject,$mail_html,$headers);
    }


also check every step of your code by writing an echo statement and printing out the values of variables. This will help you debug and understand the code properly.


Try using the "!==" operator instead.


you can use <> this operator.

0

精彩评论

暂无评论...
验证码 换一张
取 消