Reply to Re: Splitting strings, explode?

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация