views:

38

answers:

3
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.

+1  A: 

Try using the "!==" operator instead.

Kerry
+1  A: 

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.

Gaurav Sharma
!= operator used, !== it is not valid operator.
Aamir
by echo both session vales two different mail id print out, but not compared?
Aamir
!== is a valid operator, check the manual. Go to this page for clarification http://www.php.net/manual/en/language.operators.comparison.php
Gaurav Sharma
A: 

you can use <> this operator.

Deepali