Wow Barand! Thanks, that worked beautifully. But now I've discovered I've got another problem. I have another SQL query on that page that selects 2 names and generates a list. Up until a few weeks ago this list was horribly out of order because when I wrote the php initially I had neither the skill nor the time to fix that. Now I do and have the list sorted by first initial. [code]$today = date("Y-m-d"); $result = mysql_query("SELECT DISTINCT name1,name2 FROM names WHERE date>='$today' AND tjs='Y'",$db); $tjs = array(); while ($myrow = mysql_fetch_array($result)) { $tj1 = $myrow['name1']; $tj2 = $myrow['name2']; array_push($tjs,$name1); array_push($tjs,$name2); } sort($tjs); foreach ($tjs as $value){ printf("<option value=\"$value\">$value</option>\n"); }[/code] But I can't for the life of my figure out how to sort this list by surname, which is the 3rd character of the name. Any suggestions?