I'm trying to make a page where you can view all users or narrow them down by country.
The problem I'm having is selecting several countries. In other words intead of finding users from either country 1 or country 2 I want to be able to see users from countries 1,3,4,9,32.
So I have a multiple select list of countries:
<select name="country[]" size="2" multiple>
<option value="1" selected>United Kingdom</option>
<option value="2">USA</option>
and so on.
</select>
This is the code I have so far:
$countrylist=implode(',', $country);
//if the 'select by country box is checked'
if ($countryselection = "yes") {
$query = mysql_query("SELECT userid FROM user_table WHERE country IN '$countrylist'") or die (mysql_error());
}
I realise that this is probably completely wrong as I am very much a newbie with php. I would appreciate any help or advice.