|
Posted by Janwillem Borleffs on 08/27/05 13:09
mike wrote:
> I want the search to be for [ "bob" "frank" ] NOT [ "bob & frank" ]
> because my search won't match the string. Therefore, I need to be
> able to break apart the $name variable if it contains more than one
> persons. I figure it shouldn't be that hard considering I can break
> about the variables that contain " & " and ", " but so far I'm
> getting in a bit of a muddle. So I guess my question is, I do I get
> the above variables into these as easily as possible?
>
function format_query($name) {
$split = preg_split("/\s*[&,]\s*/", $name);
return urlencode(implode(" ", $split));
}
<a href="search.php?q=<?php print format_query($name); ?>">link</a>
JW
[Back to original message]
|