Hi there.
I’m trying to create a page which will have a dropdown menu of many, many languages and when submitted, will list all people who speak that language.
This may be stored in the database as “native” (native language) or “other” (other language).
At the moment, we have this code repeated for about 50 different languages (obviously not the best way) and hoped you can help us achieve the above where we just have the select menu, and only to show results when that’s submitted.
Addtionally, we want to do the same for country (which is only stored as ‘country’ in the database). Would it be ok to have the two select menus on one page to be submitted?
Current code:
[code=php]
<table class=”forms” cellpadding=”5″ cellspacing=”0″>
<tr class=”bluetop”>
<td colspan=”3″ class=”titletext center”><label class=”pagetitle1″><strong>Language Finder</strong></label></td>
</tr>
<tr class=”nav”>
<td><strong>Language</strong></td>
<td><strong>Speakers</strong></td>
</tr>
<tr onmouseover=”this.bgColor=’#bbddff'” onmouseout=”this.bgColor=’#f0f0f0′”>
<td class=”details”><strong>Afrikaans</strong></td>
<td class=”details”><?php
$list = array();
$users=mysql_query(“Select * from user where native=Afrikaans or other=Afrikaans order by account”);
while ($user=mysql_fetch_array($users))
{
$list[] = ‘<a href=”/roster/index.php?name=’.$user[‘account’].'” title=”‘.$user[‘account’].”s Profile”>’.$user[‘account’].'</a>’;
}
echo implode(‘, ‘, $list); ?></td>
</tr>
</table>
Many thanks!