You would have to store the names in say a database table and query that to find if the alternative are taken.
i.e.
for mysql it could be like...
<?
$name="gary";
db connect goes here.
$query="select * from nametable where username like '".$name."'";
$result=mysql_query($query, $dbconnection);
if ( mysql_num_rows($result) )
{
echo "The name ".$name."has been taken ";
echo "how about :<P>";
for ( $temp=1; $temp<10; $temp++ )
{
$query="select * from nametable where username like '".$name.$temp."'";
$result=mysql_query($query, $dbconnection);
if ( mysql_num_rows($result) <= 0 )
{
echo $name.$temp."<BR>";
}
}
}
?>
I think thats correct if should return a list of the names 1 - 10 if they are not taken.
Mark.