Hi, This is a part of my code..I'm making a Post form

if(!isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID']) !== '')){
            print "<tr><th>Email1: </th>
      <td><input name=\"email\" type=\"text\" class=\"textfield\" id=\"email\" /></td>
        </tr>";
        print "SESS not set"; //////////////////for test
        }

 if(isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID']) !== '')){
            $memberEmail = $_SESSION['SESS_MEMBER_ID'];
            print $memberEmail;/////////////////for test
            print "<input name=\"email\" type=\"hidden\" value=\"{$memberEmail}\"class=\"textfield\" id=\"email\" />";
        }

If session is NOT set (user NOT loggedin) then shows "Email" form field other wise just add the value in a hidden field.
But...it works both !isset and isset. It shows moth test prints : (

I cannot understand what is the problem.

Or please tell me other way to do this. Thanks.

Recommended Answers

All 2 Replies

Ok, but both IF statements have the same OR clause (!== ''). Which, if evaluates to TRUE will mean your other condition (!isset) isn't tested.

Member Avatar for LastMitch

@holosoft

If session is NOT set (user NOT loggedin) then shows "Email" form field other wise just add the value in a hidden field.
But...it works both !isset and isset. It shows moth test prints

My question is why are you using isset as a form? May I ask what do you want to do? Is this for logging in and logging out from a account? or members signing up for an account? What form is this? I can't help you if you didn't explain clearly what you need help with.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.