Jump to content

isset still not working


Monkuar

Recommended Posts

if (isset($_COOKIE['hide_div']['0']) && isset($_COOKIE['hide_div']['2'])){
$cookie1 = $_COOKIE['hide_div']['0'];
$cookie2 = $_COOKIE['hide_div']['2'];
}
if ($cookie1 == $cat_id OR $cookie2 == $cat_id) {
foreach ($this->forums as $forum_id => $forum_data)
            {
                if ($forum_data['category'] == $cat_id)
                {
                    //-----------------------------------
                    // We store the HTML in a temp var so
                    // we can make sure we have cats for
                    // this forum, or hidden forums with a
                    // cat will show the cat strip - we don't
                    // want that, no - we don't.
                    //-----------------------------------

                    $temp_html .= $this->process_forum($forum_id, $forum_data);
                }
            }

            if ($temp_html != "")
            {
                $this->output .= $this->html->CatHeader_Expandedhidden($cat_data);
                $this->output .= $this->html->end_this_cat();
            }

            unset($temp_html);
}else{
$cookie1 = '';
$cookie2 = '';

 

why in the world is it displaying Undefined variable: cookie1  and cookie2 as errors?

 

When I declared both of them even AFTER my if statement,

 

this is bogus dude, lol

 

this isset stuff is really confusing or am i just not doing it right?

Link to comment
Share on other sites

If the cookies aren't set in the first place, $cookie1 and $cookie2 don't get declared at all.

 

<?php
//declare the vars
$cookie1=0;
$cookie2=0;

if (isset($_COOKIE['hide_div']['0']) && isset($_COOKIE['hide_div']['2'])){
$cookie1 = $_COOKIE['hide_div']['0'];
$cookie2 = $_COOKIE['hide_div']['2'];
}
if ($cookie1 == $cat_id OR $cookie2 == $cat_id) {
foreach ($this->forums as $forum_id => $forum_data)
            {
                if ($forum_data['category'] == $cat_id)
                {
                    //-----------------------------------
                    // We store the HTML in a temp var so
                    // we can make sure we have cats for
                    // this forum, or hidden forums with a
                    // cat will show the cat strip - we don't
                    // want that, no - we don't.
                    //-----------------------------------

                    $temp_html .= $this->process_forum($forum_id, $forum_data);
                }
            }

            if ($temp_html != "")
            {
                $this->output .= $this->html->CatHeader_Expandedhidden($cat_data);
                $this->output .= $this->html->end_this_cat();
            }

            unset($temp_html);
}else{
$cookie1 = '';
$cookie2 = '';

Link to comment
Share on other sites

fixed this by simpling adding this:

 

if (!isset($_COOKIE['hide_div']['0'])){
$_COOKIE['hide_div']['0'] = 0;
}	
if (!isset($_COOKIE['hide_div']['2'])){
$_COOKIE['hide_div']['2'] = 0;
}	

 

rofl i think I am thinking to hard?

Link to comment
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.