Jump to content

Recommended Posts

Hi people!

I have this code:

if ($_POST['remember'] == true)
                        {
                                // COOKIES ON!
                                $time = time() + 20000;
                                setcookie(user, $username, $time);
                                setcookie(pass, $password, $time);
                                header("Location: index.php");
                                echo "<h1 class='welcome'>Welcome ".$_COOKIE['user']." |</h1>";
                                echo "<div id='divlogin' style='visibility:hidden'></div>";
                                echo "<a href='logout.php'><h1 class='logout'><b>Logout</b></h1></a>";

                        }elseif ($_POST['remember'] == false){

                                echo "<div id='divlogin' style='visibility:hidden'></div>";
                                echo "Div hidden!";
                                                }

"remember" - is a checkbox.

So, if the checkbox is checked then I will activate the cookies and hide the divlogin (till now everything is fine), but if the checkbox isn't checked, I will just hide the divlogin (and this don't happen), however, the echo "Div hidden!" works nicely. The code detects if the checkbox is checked or not, the only problem is that if isn't checked the div doens't hide.

 

Any ideas?  :-\

 

Thanks  :D

Link to comment
https://forums.phpfreaks.com/topic/220767-hiding-div/
Share on other sites

Hi! I'd already tried that and is the same thing. :shrug:

	if ($_POST['remember'] == true)
		{

			// COOKIES ON!
			$tempo = time() + 20000;
			setcookie(user, $username, $tempo);
			setcookie(pass, $password, $tempo);
			header("Location: index.php");

			echo "<h1 class='welcome'>Bem vindo ".$_COOKIE['user']." |</h1>";
			echo "<div id='divlogin' class='divlogin' style='display:none'></div>";
			echo "<a href='logout.php'><h1 class='logout'><b>Logout</b></h1></a>";

			// OFF
		}elseif ($_POST['remember'] == false){

			// Dispomos as divs, etc, como desejo.
			echo "<div id='divlogin' class='divlogin' style='display:none'></div>";
			echo "<a href='logout.php'><h1 class='logout'><b>Logout</b></h1></a>";

			}

 

Can't you give me an example with a checkbox and hiding divs?

Thanks!!

Link to comment
https://forums.phpfreaks.com/topic/220767-hiding-div/#findComment-1143582
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.