Compare two index querys

Hi guys! I need compare my POST index with the query index. But when I set value with repeat always transforms into an object. How can I receive a true or false for each compare?

Hey @Barusu,

What exactly does your $_POST contains?
I guess you want to compare an input from your POST with a field from your query…
Screenshot your POST and your Query

After a second look, I see that you have 3 serial repeats but none of them is nested into another…
So, I think you are looking for:
-repeat(POST)
----repeat(Query)
-------If (post.$index == query.$index)
------------(set value…)
-Database Update

What exactly are you trying to archive?

Hi @famousmag, take a look:
image
image

I tried what you answered for, but always I get a true case

I haven’t understand what you’re trying to do…

Anyway, try setting the output filter of your POST.repeat to Exclude
Then pull the $value…

EDIT:
No matter if the output filter is Include or Exclude…

But pay attention that the order that the values come ( repeat $index) depends on their order inside your form…


So, you are going to compare them with… what?
I am curious to see what you are up to

Thanks for reply @famousmag. I have a form, so the POST have informations from my server connect form update. And my query has the same form, but with old informations. I want to compare POST informations with query informations, with which one the same inputs.

The main question of all this, is obtain the information (true or false) that if has an changed value of some field, or not, based on comparing method.

One question…

Why don’t you check that on client-side before submit the form?
This way you could probably know on server-side which fields have changed…
There must be many ways to handle this…
One quick way that comes to mind is have a flag for each field in your form (static value=“false”) and set it to “true” if the field have changed.
So, in your Database Updater use the condition:

Or you could create an array from these flags and include it in your post and check that…

Just saying…

Thanks @famousmag, but my case I have 17 inputs. Dont sound so worthy for me to create too much variables :sweat: