Hi Everyone I have a quick question regarding this section of my code. <?php find_selected_page(); //Returns selected page or subject?> <?php if (isset($_GET['page'])){ $type = "page"; $fieldname = $sel_page; if(intval($_GET['page']) == 0 ){ redirect_to("content.php"); } } if (isset($_GET['guide_page'])){ $type = "guide_page"; $fieldname = $guide_pages; if(intval($_GET['guide_page']) == 0 ){ redirect_to("content.php"); } } PHP: As you can see depending on the value of the GET variable the variable $fieldname is being set. When the GET var is "page" I am having no problems. However for some reason when the GET var is "guide_page" and it reaches this line $fieldname = $guide_pages; PHP: The variable $fieldname is not being set. I did some troubleshooting which led me to this part of the code. I then did print_r($guide_pages) which provided the expected results. I then did print_r($fieldname) and got nothing. I might have just made a small error in the code, but I can't find it. I also checked my find_selected_page() function which is working properly. Any help is appreciated, thanks in advance.
where is variable $guide_pages set? what does it contain? do you do print_r for $fieldname right after "$fieldname = $guide_pages" ?
$guide_pages is a global variable that is set in the find_selected_page() function I made. Here is the code in that function where it is set: elseif(isset($_GET['guide_page'])){ $guide_subjects = get_guide_page_by_id($_GET['guide_page']); $sel_subject = NULL; $sel_page = NULL; $guide_pages = NULL; } PHP: when i did print_r I did it after $fieldname was set.
Nevermind, I found the error...its in the code I just posted above. i had the wrong variable set to NULL as you can see. Of course I realize this after I ask for help....thanks though, you question let me to finding the error.
You are getting nothing because you are "Setting" the "$guide_pages" to NULL in here: elseif(isset($_GET['guide_page'])){ $guide_subjects = get_guide_page_by_id($_GET['guide_page']); $sel_subject = NULL; $sel_page = NULL; $guide_pages = NULL; } PHP: also, are you sure that you had set it to "global" ??? I don't see it on the code above. ~Mike
If you use !empty() in the place of isset(), you can check the variables for being set and for having a null value Just thought I would toss that in there too.