Antonio Garcia Posted September 14, 2004 Share Posted September 14, 2004 I try to modify the tep_get_all_get_params() function to get the values of the $_GET variables when are 'arrays' insead 'single' values. (For example, when you submit a form with a select field with a 'multiple' option you get a array insead a single value). As you know it work well if you want to reproduce a urls like: XXX.php?action=delete&id=22 But if I have some like this: XXX.php?action=delete&id%5B%5D=22&id%5B%5D=23 This function don't work at all because the value of 'id' is an array with values id[0]=22 and id[1]=23 When I try to use in a new script that uses: tep_href_link(FILENAME_XXX, tep_get_all_get_params()) to jump to the same file but with the $HTTP_GET_VARS (some of them Arrays) don't work. I try with this: ////// Return all HTTP GET variables, except those passed as a parameter function tep_get_all_get_params($exclude_array = '') { global $HTTP_GET_VARS; if (!is_array($exclude_array)) $exclude_array = array(); $get_url = ''; if (is_array($HTTP_GET_VARS) && (sizeof($HTTP_GET_VARS) > 0)) { reset($HTTP_GET_VARS); while (list($key, $value) = each($HTTP_GET_VARS)) { if ( (strlen($value) > 0) && ($key != tep_session_name()) && ($key != 'error') && (!in_array($key, $exclude_array)) && ($key != 'x') && ($key != 'y') ) { // modification if (is_array($value)) { while (list($key, $value2) = each($value)) { $get_url .= $key . '=' . rawurlencode(stripslashes($value2)) . '&'; } } else { // modification end $get_url .= $key . '=' . rawurlencode(stripslashes($value)) . '&'; } } } } return $get_url; } ///////////////////////////// But it don't work. Any ideas? All the best. Antonio Link to comment Share on other sites More sharing options...
zipicip Posted October 20, 2011 Share Posted October 20, 2011 function tep_get_all_get_params($exclude_array = '') { global $_GET; if (!is_array($exclude_array)) $exclude_array = array(); $get_url = ''; if (is_array($_GET) && (sizeof($_GET) > 0)) { reset($_GET); while (list($key, $value) = each($_GET)) { if ( ((is_string($value) && (strlen($value) > 0)) || (is_array($value) && (!empty($value)))) && ($key != tep_session_name()) && ($key!= 'error') && (!in_array($key, $exclude_array)) && ($key != 'x') && ($key != 'y') ) { if (is_array($value)) { $get_url .= $key . '[]=' . rawurlencode(stripslashes($value[0])) . '&'; }else{ $get_url .= $key . '=' . rawurlencode(stripslashes($value)) . '&'; } } } } return $get_url; } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.