0

In my view, I have two filters: title (text box), and date (combobox); date has two values: year and month.

When I select the filters parameters in the view, and I click search, the filter values appears in the URL such as in mysite/views-path?title_filter=aaa&date_filter[year][value]=2012&date_filter[month][value]=3.

I used $_GET to get the value of the title filter, and it worked, but I can't get the date values using print $_GET['date_filter[year][value]'];.

Can anyone tell me how to get values like date using $_GET?

2

Arrays in query strings get converted into actual PHP arrays when you use $_GET.

To get the value in your case you'd use something like:

print $_GET['date_filter']['year']['value'];
  • i tried what you told me but doesn't work. – abd May 17 '12 at 15:24
  • It must be a problem with Views then; you can test the logic yourself by installing the devel module and going to mysite.com/devel/php?date_filter[year][value]=2012. Then put print $_GET['date_filter']['year']['value']; in the code textfield and press 'Execute'. You'll see the string '2012' printed in the messages area, which proves the above method works – Clive May 17 '12 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.