Hi guys, Do you know how I can change the "+" to "-" in the search string (osCommerce). Example: http://example.com/search_result.php?keywords=asd+asd should look: http://example.com/search_result.php?keywords=asd-asd How can I do that? I think there are two functions that could be related to the problem...but I am not a programmer, so I need help: function tep_sanitize_string($string) { $string = ereg_replace(' +', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); } // Break up $search_str on whitespace; quoted string will be reconstructed later $pieces = split('[[:space:]]+', $search_str); $objects = array(); $tmpstring = ''; $flag = ''; for ($k=0; $k<count($pieces); $k++) { while (substr($pieces[$k], 0, 1) == '(') { $objects[] = '('; if (strlen($pieces[$k]) > 1) { $pieces[$k] = substr($pieces[$k], 1); } else { $pieces[$k] = ''; } } $post_objects = array(); while (substr($pieces[$k], -1) == ')') { $post_objects[] = ')'; if (strlen($pieces[$k]) > 1) { $pieces[$k] = substr($pieces[$k], 0, -1); } else { $pieces[$k] = ''; } } PHP:
Hey, Browsers normaly make added keywords with a "+" symbol. So you would need to do this when the user submits the form, you can use php but might be quicker to just use a small javascript function. If you can post the "search form" I can do it for ya.
If you use: $new_string=str_replace("+","-",$QUERY_STRING); Would creata the string "keywords=asd-asd". Using either the str_replace function or the ereg_replace function works. The ereg_replace function is the POSIX compliant version of the function.