Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8397141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:42:59+00:00 2026-06-09T20:42:59+00:00

I am trying to hide a div once a user has logged into there

  • 0

I am trying to hide a div once a user has logged into there account of my online store (built with cartweaver 4 php) but i just cant seem to get it to work.

the php code for defining wether the user is logged in or not is as followed:

if(!strlen($_SESSION["cwclient"]["cwCustomerID"]) ||
    $_SESSION["cwclient"]["cwCustomerID"] === 0 ||
    $_SESSION["cwclient"]["cwCustomerID"] === "0" ||
    $_SESSION["cwclient"]["cwCustomerType"] == 0 ||
    (isset($_SESSION["cwclient"]["cwCustomerCheckout"]) &&
       strtolower($_SESSION["cwclient"]["cwCustomerCheckout"]) == "guest"))

and the div i would like to hide upon login, which contains a table, have been given an id and class of:

  <div id="newcustomertable" class='newcustomer'>

I have tried applying this method using css: Show Hide div if, if statement is true

but that ended up giving me an undefined variable error on my testing server.

I admit i am a bit of a php newbie, so if anyone who is able to make more sense of this could help out and possibly find a solution it would be much appreciated.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:43:00+00:00Added an answer on June 9, 2026 at 8:43 pm
    <div id ="newcustomertable"></div>
    <?
    if(!isset($_SESSION["cwclient"]["cwCustomerID"]) || 
    !strlen(@$_SESSION["cwclient"]["cwCustomerID"]) ||
    @$_SESSION["cwclient"]["cwCustomerID"] === 0 ||
    @$_SESSION["cwclient"]["cwCustomerType"] == 0 ||
    (isset($_SESSION["cwclient"]["cwCustomerCheckout"]) &&
    strtolower(@$_SESSION["cwclient"]["cwCustomerCheckout"]) == "guest"))
    {
    ?>
    <script>
    document.getElementById("newcustomertable").style.display = "none";
    </script>
    <?  
    }
    ?>
    

    Make sure that the condition check is AFTER the div element getting rendered. Because if you put it before the element the page would not have fully rendered and so the script will not be able to get the div that you want to hide.

    REVERSE Condition based on OP’s request. I know this is a kluge, folks. Dont flame me!

    <div id ="newcustomertable"></div>
    <?
    if(!isset($_SESSION["cwclient"]["cwCustomerID"]) || 
    !strlen(@$_SESSION["cwclient"]["cwCustomerID"]) ||
    @$_SESSION["cwclient"]["cwCustomerID"] === 0 ||
    @$_SESSION["cwclient"]["cwCustomerType"] == 0 ||
    (isset($_SESSION["cwclient"]["cwCustomerCheckout"]) &&
    strtolower(@$_SESSION["cwclient"]["cwCustomerCheckout"]) == "guest"))
    {
     //do nothing
    }
    else
    {
    ?>
    <script>
    document.getElementById("newcustomertable").style.display = "none";
    </script>
    <?  
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to show / hide a DIV when a user clicks on its
I'm trying to fadein a div only ONCE for when the user lands on
im trying to hide the parent div that contains the clicked link: <div class=user
I am trying to hide the div class hideme based on value of full_day
I'm trying to hide a div in my template if the URL that is
I am trying to hide a div with an id #op-four using on instead
I'm trying to hide a div if certain value are selected in a drop
I am trying to hide/show/toggle a div when a button is clicked. I am
I'm developing smartphone hybrid applications. I'm trying to hide/show a <div> with slideDown /
I'm trying to create a standardized show/hide element system, like so: <div class=opener popup_1>Click

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.