Compare $_POST returned values with term array


I am trying to compare Post values returned from AJAX with available taxonomy term_id but somehow I am out of luck.
My $_POST[‘recvid’] values based on the user selection for example are ’70=on&72=on&74=on’ .

    if( $brands = get_terms( array( 'taxonomy' => 'recipebrands' ) ) ) :  //constructing array of available terms
    $brands_terms = array(); 
    foreach( $brands as $brand ) { //going thru all terms
     if( ????? ) // trying to compare if POSTED values are within available term array
           $brands_terms[] = $brand->slug;   //if yes, then build the array of all slugs

Somehow I am stuck within the if clause and cannot figure out how to build the $brands_terms array
I tried
isset( $_POST['recvid'][$brand->term_id ] ) && $_POST['recvid'][$brand->term_id] == 'on') but without luck.

Yes I know, should be learning much more about these things 🙂

jam 1 month 0 Answers 6 views 0

Leave an answer