# Compare a get variable with a path of categories

I have a series of if:elseif statements that compare $_GET Variables using "{exp:parameters:get name='price'}"=="<?php echo$myVariableHere; ?>". This is filtering out some of the entries so that they don't show, this works perfectly.

NOTE: $myVariableHere is coming from <?php$myVariableHere="{categories show_group='#'}{category_name}{/categories}"; ?>

The exception is my 'region' variable, because it uses child categories. I tried to call them this way, <?php $myVariableHere="array{categories show_group='#' backspace='2'}'{category_name}', {/categories}"; ?> The problem is that even though it appears to print to my page correctly ('Canada', 'Foo', 'Bar') it does not have separate keys in the array, they are all part of the 1st key. So I can not call on the categories separately to use them in my comparison. In the end, I need to compare the$_GET VARIABLE of ?region=Canada to the entries categories in that group ('Canada' with a child of 'Foo' with a child of 'Bar').

Looking forward to any suggestions. NOTE: I have been using gw:categories in places.

• I guess you had a look at low seg2cat for getting category info from URL segments? – Jérôme Coupé Jul 16 '13 at 9:05
• Thanks, sorry I didn't add the pre_code quotes in question, now added above. I'm using segments to call the entries within the channel entry, the \$_GET Variables are created on the fly at the front end by the user selecting from a menu and the categories need the flexibility to be added in the entries also on the fly. Low seg2cat may not work with changing menu constantly changing menu options on the front end. Let me know if I am wrong. I have done a lot of work to now and changing it 'completely' may hurt my brain, but I do NEED to get it working, so... anything it worth a try. – JayB Jul 16 '13 at 13:55