Hi,
Your string test would be comparing the row variable with the actual string '$testto'.
You want to loose the apostrophes to get the comparison to work within you code.
The better way to implement would be to search the database for the name entered within the query. That way if you have a record returned, you know you have a match. If the number of records returned are zero, they have typed something in wrong.
$sql = mysql_query ("SELECT `username` FROM `users` WHERE username like '" . addslashes(%testto) . "'");
if ( mysql_num_rows($sql) > 0 )
$to = $testto;
else
$to = "Username not recognised";
Please note that I have used a LIKE function in the SQL meaning that it would be case insensitive. Also adding addslashes() to the variable is an intial preventative to stop anything nasty to be done to the database, this could be extended further.
Cheers
Stuff