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 4259702
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:49:14+00:00 2026-05-21T05:49:14+00:00

I need to hide or show a div that have a slideshow inside. The

  • 0

I need to hide or show a div that have a slideshow inside.
The idea is to give to the users a link for them to hide or show the div.

At the moment I call the slideshow on the body of the page with <?php include('slideshow.php'); ?>

After the user clicks on the link to hide/show the div I will like to call a second file (
<?php include('no-slideshow.php'); ?> ) which contain a diferent div.

As far as I had found there is no way to achieve this with sessions, or at least I did’t find a solution to this problem.

My guess is that this need to be done with cookies, but I don’t understend how.

  • 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-05-21T05:49:15+00:00Added an answer on May 21, 2026 at 5:49 am

    If you don’t want to use JavaScript only way to achieve that is to use link (requires page to be reloaded).

    This is basic logic only, not a complete solution, but think you’ll get the point.

    Create a link on web page to the server-side script.

    <a href="toggle_visibility.php">hide/show</a>
    

    Create script togle_visibility.php to process user’s request.

    <?php
    
      $hidediv = isset($_COOKIE['hide_div']) && ($_COOKIE['hide_div'] == 'hide');
      $cookie_value = !$hidediv ? 'hide' : 'show';
      setcookie('hide_div', $cookie_value, time()+32000000); // cookie expires after year
      header('location: http://www.mysite.com/index.php');
    
    ?>
    

    All you need now (after return to original page) is to check value stored in cookie and decide do you want od not to show that div to do user.

    <?php
    
      ... more code
    
      $hidediv = isset($_COOKIE['hide_div']) && ($_COOKIE['hide_div'] == 'hide');
      if ($hidediv) {
        include('no-slideshow.php');
        }
      else {
        include('slideshow.php');
        }
    
      ... more code 
    
    ?>
    

    EDIT: $hidediv condition.

    It works if user has JavaScript disabled but doesn’t work if cookies has been disabled in browser settings.

    I did not check this code, so same typos are possible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a div that gets hidden and displayed, via .hide() and .show() .
I have a drop-down and need to show hidden div that corresponds to the
I have a div (#CME) that is hidden initially, I need to show it
I'm new to jQuery and need some help to show and hide a div
I am wanting to use jquery to do a show/hide of a DIV from
I have some SQL output that id like to format into a collapsible div.
That's a simple task in ASP.NET WebForms:If you want to show/hide a control all
I have a list of items, each of which needs to show a div.
I have a button that when hovered over (mouseover) displays a div right below
I have a container that has several divs with content. i need to be

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.