hello all,
Im trying to dynamically insert text onto a page by inserting a value from a query string using php. This was simple enough when i wanted to insert the entire value, but im having trouble finding information on how to search the value for a word (from a list of words) and if it contains one to echo/print just that word, not the entire value.
So far i have the basic 'return the whole value' scripts.
<?php if($_GET['KEY'] == "")
{
// no keyword entered
echo "";
}
else
{
echo $_GET['KEY']." Or Any City";
}
?>
</span>
The value of the key contains a location eg. washington, the value could just be one word(and the above code works if it is), but its more likely to contain more words eg. ?key=washington
something somethingelse
I need to find a way of searching this value against a list of locations (eg. washington, new york, la, etc.. If the value of the key contains one of the locations in the list, then i need to insert just that location into the page, not the entire value.
Im not sure how this is best done, if anyone has any ideas or knows where i can find help, it'd be much appreciated.
Thanks, Rika