WordPress query_posts with multiple tax_query

You could build an intermediary array for the tax_query parameter:

$tax_query = array();

$taxonomies = array(
  'product_cat',
  'sub_category',
);
foreach ( $taxonomies as $taxonomy ) {
  if ( ! empty( $_POST[ $taxonomy  ] ) ) {
    $tax_query[] = array(
      'taxonomy' => $taxonomy,
      'terms'    => $_POST[ $taxonomy  ],
    );
  }
}

query_posts(
  array(
    // …
    'tax_query' => $tax_query,
  ),
);

techhipbettruvabetnorabahisbahis forumutaraftarium24eduedueduedusedueduedueduedusedu