Forums

OR in dbRead conditions

Ninetta 12 Nov, 2014
good Morning,

I have a form with two boxes and I need to filter a third based on the values selected in the first two. The first two boxes indicate the province of birth and residence of that, I need to filter the third based on the two previous values (OR).

I've seen several FAQs and tried the following code (http://www.chronoengine.com/forums/posts/f2/t94245.html?page=1)
in the settings "Conditions" of the "Db Read" and this would be what I'm looking for:

<? php
$ arr = json_decode ('[91,92] ", true);
return array ("idprovincia" => $ arr);
?>
this works

How can I build the array arr & dynamically inserting the values of the dropdown provincia1 and provincia2?
I tried with:

<? php
$ p1 = $ form-> data ['provincia1']
$ p2 = $ form-> data ['provincia2']
$ arr = json_decode ('pr $, $ pd ", true);
return array ("idprovincia" => $ arr); // id IN (blah blah blah) - good
?>

but this code does not work.

What is wrong?
Thanks to all
Nina
Ninetta 12 Nov, 2014
Sorry,

The translator has modified my code which is:

<?php
$p1 = $form->data['provincia1']
$p2 = $form->data['provincia2']
$arr = json_decode("$p1,$p2", true);
return array("idprovincia" => $arr );
?>

this code does not work. What is wrong?

Thanks again,
Nina
This topic is locked and no more replies can be posted.